mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
clean up test imports
This commit is contained in:
parent
a015dad566
commit
5082d40ff5
8 changed files with 14 additions and 46 deletions
|
@ -14,9 +14,6 @@ mod helpers;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_list {
|
mod gen_list {
|
||||||
use crate::helpers::with_larger_debug_stack;
|
use crate::helpers::with_larger_debug_stack;
|
||||||
use bumpalo::Bump;
|
|
||||||
use inkwell::context::Context;
|
|
||||||
use inkwell::execution_engine::JitFunction;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_list_literal() {
|
fn empty_list_literal() {
|
||||||
|
|
|
@ -13,10 +13,7 @@ mod helpers;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_num {
|
mod gen_num {
|
||||||
use crate::helpers::{can_expr, infer_expr, uniq_expr, CanExprOut};
|
/*
|
||||||
use bumpalo::Bump;
|
|
||||||
use inkwell::context::Context;
|
|
||||||
use inkwell::execution_engine::JitFunction;
|
|
||||||
use inkwell::passes::PassManager;
|
use inkwell::passes::PassManager;
|
||||||
use inkwell::types::BasicType;
|
use inkwell::types::BasicType;
|
||||||
use inkwell::OptimizationLevel;
|
use inkwell::OptimizationLevel;
|
||||||
|
@ -24,6 +21,7 @@ mod gen_num {
|
||||||
use roc_gen::llvm::convert::basic_type_from_layout;
|
use roc_gen::llvm::convert::basic_type_from_layout;
|
||||||
use roc_mono::layout::Layout;
|
use roc_mono::layout::Layout;
|
||||||
use roc_types::subs::Subs;
|
use roc_types::subs::Subs;
|
||||||
|
*/
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn f64_sqrt() {
|
fn f64_sqrt() {
|
||||||
|
|
|
@ -13,17 +13,6 @@ mod helpers;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_primitives {
|
mod gen_primitives {
|
||||||
use crate::helpers::{can_expr, infer_expr, uniq_expr, CanExprOut};
|
|
||||||
use bumpalo::Bump;
|
|
||||||
use inkwell::context::Context;
|
|
||||||
use inkwell::execution_engine::JitFunction;
|
|
||||||
use inkwell::passes::PassManager;
|
|
||||||
use inkwell::types::BasicType;
|
|
||||||
use inkwell::OptimizationLevel;
|
|
||||||
use roc_gen::llvm::build::{build_proc, build_proc_header};
|
|
||||||
use roc_gen::llvm::convert::basic_type_from_layout;
|
|
||||||
use roc_mono::layout::Layout;
|
|
||||||
use roc_types::subs::Subs;
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,6 @@ mod helpers;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_records {
|
mod gen_records {
|
||||||
use crate::helpers::{can_expr, infer_expr, uniq_expr, CanExprOut};
|
|
||||||
use bumpalo::Bump;
|
|
||||||
use inkwell::context::Context;
|
|
||||||
use inkwell::execution_engine::JitFunction;
|
|
||||||
use inkwell::passes::PassManager;
|
|
||||||
use inkwell::types::BasicType;
|
|
||||||
use inkwell::OptimizationLevel;
|
|
||||||
use roc_gen::llvm::build::{build_proc, build_proc_header};
|
|
||||||
use roc_gen::llvm::convert::basic_type_from_layout;
|
|
||||||
use roc_mono::layout::Layout;
|
|
||||||
use roc_types::subs::Subs;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_record() {
|
fn basic_record() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
|
|
|
@ -13,18 +13,6 @@ mod helpers;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_tags {
|
mod gen_tags {
|
||||||
use crate::helpers::{can_expr, infer_expr, uniq_expr, CanExprOut};
|
|
||||||
use bumpalo::Bump;
|
|
||||||
use inkwell::context::Context;
|
|
||||||
use inkwell::execution_engine::JitFunction;
|
|
||||||
use inkwell::passes::PassManager;
|
|
||||||
use inkwell::types::BasicType;
|
|
||||||
use inkwell::OptimizationLevel;
|
|
||||||
use roc_gen::llvm::build::{build_proc, build_proc_header};
|
|
||||||
use roc_gen::llvm::convert::basic_type_from_layout;
|
|
||||||
use roc_mono::layout::Layout;
|
|
||||||
use roc_types::subs::Subs;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn applied_tag_nothing_ir() {
|
fn applied_tag_nothing_ir() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
|
|
|
@ -133,7 +133,7 @@ pub fn helper_without_uniqueness<'a>(
|
||||||
// We have to do this in a separate pass first,
|
// We have to do this in a separate pass first,
|
||||||
// because their bodies may reference each other.
|
// because their bodies may reference each other.
|
||||||
|
|
||||||
for ((symbol, layout), proc) in procs.to_specialized_procs(env.arena).drain() {
|
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
||||||
let (fn_val, arg_basic_types) =
|
let (fn_val, arg_basic_types) =
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ pub fn helper_with_uniqueness<'a>(
|
||||||
// Add all the Proc headers to the module.
|
// Add all the Proc headers to the module.
|
||||||
// We have to do this in a separate pass first,
|
// We have to do this in a separate pass first,
|
||||||
// because their bodies may reference each other.
|
// because their bodies may reference each other.
|
||||||
for ((symbol, layout), proc) in procs.to_specialized_procs(env.arena).drain() {
|
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
||||||
let (fn_val, arg_basic_types) =
|
let (fn_val, arg_basic_types) =
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
|
|
||||||
|
@ -400,6 +400,10 @@ pub fn helper_with_uniqueness<'a>(
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! assert_opt_evals_to {
|
macro_rules! assert_opt_evals_to {
|
||||||
($src:expr, $expected:expr, $ty:ty, $transform:expr, $leak:expr) => {
|
($src:expr, $expected:expr, $ty:ty, $transform:expr, $leak:expr) => {
|
||||||
|
use bumpalo::Bump;
|
||||||
|
use inkwell::context::Context;
|
||||||
|
use inkwell::execution_engine::JitFunction;
|
||||||
|
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
|
|
||||||
let context = Context::create();
|
let context = Context::create();
|
||||||
|
@ -426,6 +430,10 @@ macro_rules! assert_opt_evals_to {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! assert_llvm_evals_to {
|
macro_rules! assert_llvm_evals_to {
|
||||||
($src:expr, $expected:expr, $ty:ty, $transform:expr, $leak:expr) => {
|
($src:expr, $expected:expr, $ty:ty, $transform:expr, $leak:expr) => {
|
||||||
|
use bumpalo::Bump;
|
||||||
|
use inkwell::context::Context;
|
||||||
|
use inkwell::execution_engine::JitFunction;
|
||||||
|
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
|
|
||||||
let context = Context::create();
|
let context = Context::create();
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub enum InProgressProc<'a> {
|
||||||
|
|
||||||
impl<'a> Procs<'a> {
|
impl<'a> Procs<'a> {
|
||||||
// TODO investigate make this an iterator?
|
// TODO investigate make this an iterator?
|
||||||
pub fn to_specialized_procs(self, arena: &'a Bump) -> MutMap<(Symbol, Layout<'a>), Proc<'a>> {
|
pub fn get_specialized_procs(self, arena: &'a Bump) -> MutMap<(Symbol, Layout<'a>), Proc<'a>> {
|
||||||
let mut result = MutMap::with_capacity_and_hasher(self.specialized.len(), default_hasher());
|
let mut result = MutMap::with_capacity_and_hasher(self.specialized.len(), default_hasher());
|
||||||
|
|
||||||
for (key, in_prog_proc) in self.specialized.into_iter() {
|
for (key, in_prog_proc) in self.specialized.into_iter() {
|
||||||
|
|
|
@ -73,7 +73,7 @@ mod test_mono {
|
||||||
interns.all_ident_ids.insert(home, ident_ids);
|
interns.all_ident_ids.insert(home, ident_ids);
|
||||||
|
|
||||||
let mut procs_string = procs
|
let mut procs_string = procs
|
||||||
.to_specialized_procs(mono_env.arena)
|
.get_specialized_procs(mono_env.arena)
|
||||||
.values()
|
.values()
|
||||||
.map(|proc| proc.to_pretty(200))
|
.map(|proc| proc.to_pretty(200))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue