mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Able variables through different functions compile
This commit is contained in:
parent
a07323fb40
commit
b9f79fdd31
2 changed files with 27 additions and 0 deletions
|
@ -478,6 +478,10 @@ pub fn canonicalize_defs<'a>(
|
|||
}
|
||||
};
|
||||
|
||||
if pattern_type == PatternType::TopLevelDef {
|
||||
env.top_level_symbols.insert(member_sym);
|
||||
}
|
||||
|
||||
// What variables in the annotation are bound to the parent ability, and what variables
|
||||
// are bound to some other ability?
|
||||
let (variables_bound_to_ability, variables_bound_to_other_abilities): (Vec<_>, Vec<_>) =
|
||||
|
|
|
@ -84,3 +84,26 @@ fn alias_member_specialization() {
|
|||
u64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ability_constrained_in_non_member_usage() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [ result ] to "./platform"
|
||||
|
||||
Hash has
|
||||
hash : a -> U64 | a has Hash
|
||||
|
||||
mulHashes = \x, y -> hash x * hash y
|
||||
|
||||
Id := U64
|
||||
hash = \$Id n -> n
|
||||
|
||||
result = mulHashes ($Id 5) ($Id 7)
|
||||
"#
|
||||
),
|
||||
35,
|
||||
u64
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue