clean up test imports

This commit is contained in:
Folkert 2020-08-08 21:56:43 +02:00
parent a015dad566
commit 5082d40ff5
8 changed files with 14 additions and 46 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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;

View file

@ -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!(

View file

@ -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!(

View file

@ -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();

View file

@ -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() {

View file

@ -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<_>>();