Solve and gen ability members that bind other able variables

This commit is contained in:
Ayaz Hafiz 2022-04-21 14:11:32 -04:00 committed by ayazhafiz
parent 5fe902b8d3
commit b5efd830e5
6 changed files with 110 additions and 28 deletions

View file

@ -216,3 +216,29 @@ fn ability_used_as_type_still_compiles() {
u64
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn ability_member_takes_different_able_variable() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ result ] to "./platform"
Hash has hash : a -> U64 | a has Hash
IntoHash has intoHash : a, b -> b | a has IntoHash, b has Hash
Id := U64
hash = \$Id n -> n
User := Id
intoHash = \$User id, _ -> id
result = hash (intoHash ($User ($Id 123)) ($Id 1))
"#
),
123,
u64
)
}