feat(unify): more tests and some new ones fail

This commit is contained in:
rvcas 2021-03-21 12:22:42 -04:00
parent 36ec1a0f56
commit eff822f48f

View file

@ -566,13 +566,37 @@ mod solve_expr {
); );
} }
#[test]
fn applied_tag() {
infer_eq_without_problem(
indoc!(
r#"
List.map [ "a", "b" ] \elem -> Foo elem
"#
),
"List [ Foo Str ]*",
)
}
#[test] #[test]
fn applied_tag_function() { fn applied_tag_function() {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
foo : [ Foo Str ]* foo = Foo
foo "hi"
"#
),
"[ Foo Str ]*",
)
}
#[test]
fn applied_tag_function_list_map() {
infer_eq_without_problem(
indoc!(
r#"
List.map [ "a", "b" ] Foo List.map [ "a", "b" ] Foo
"# "#
), ),
@ -581,30 +605,44 @@ mod solve_expr {
} }
#[test] #[test]
fn applied_tag_function_other() { fn applied_tag_function_list() {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
foo : [ Foo Str ]* [ Foo, \x -> Bar x ]
Foo "hi"
"# "#
), ),
"[ Foo Str ]*", "List (a -> [ Bar a, Foo a ]*)",
) )
} }
#[test] #[test]
fn applied_tag() { fn applied_tag_function_record() {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
foo : [ Foo Str ]* foo = Foo
List.map [ "a", "b" ] \elem -> Foo elem {
x: [ foo, Foo ],
y: [ foo, \x -> Foo x ],
z: [ foo, \x,y -> Foo x y ]
}
"# "#
), ),
"List [ Foo Str ]*", "{ x: List (a, b -> [ Foo a b ]*), y: List (a, b -> [ Foo a b ]*), z: List (a, b -> [ Foo a b ]*) }",
)
}
#[test]
fn applied_tag_function_mismatch() {
infer_eq_without_problem(
indoc!(
r#"
\foo -> { x: [ foo, Foo ], y: [ foo, \x -> Foo x ] }
"#
),
"",
) )
} }