tests(test_gen): add tests for mono

This commit is contained in:
rvcas 2021-03-27 18:00:36 -04:00
parent 9da0193f2c
commit fe9e9af576
3 changed files with 27 additions and 0 deletions

View file

@ -2802,6 +2802,16 @@ pub fn with_hole<'a>(
use crate::layout::UnionVariant::*;
let arena = env.arena;
match layout_cache.from_var(arena, variant_var, env.subs) {
Err(e) => panic!("invalid layout {:?}", e),
Ok(Layout::FunctionPointer(argument_layouts, ret_layout)) => {
dbg!(argument_layouts, ret_layout);
}
Ok(_) => {
panic!("idk")
}
}
let res_variant = crate::layout::union_sorted_tags(env.arena, variant_var, env.subs);
let variant = match res_variant {

View file

@ -1,6 +1,7 @@
use crate::ir::Parens;
use bumpalo::collections::Vec;
use bumpalo::Bump;
use core::panic;
use roc_collections::all::{default_hasher, MutMap, MutSet};
use roc_module::ident::{Lowercase, TagName};
use roc_module::symbol::{Interns, Symbol};

View file

@ -1803,3 +1803,19 @@ fn cleanup_because_exception() {
RocList<bool>
);
}
#[test]
fn applied_tag_function() {
assert_evals_to!(
indoc!(
r#"
x : List [ Foo Str ]
x = List.map [ "a", "b" ] Foo
x
"#
),
RocList::from_slice(&[false; 1]),
RocList<bool>
);
}