mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-31 00:57:24 +00:00
Store lambda set variables as flex inference variables
This is actually correct - the rigid approach is not. Lambda set variables should be inferred in-scope.
This commit is contained in:
parent
54cc5e4c29
commit
561f3d9711
3 changed files with 9 additions and 12 deletions
|
@ -3808,9 +3808,9 @@ fn instantiate_rigids(
|
|||
// wildcards are always freshly introduced in this annotation
|
||||
new_rigid_variables.extend(introduced_vars.wildcards.iter().copied());
|
||||
|
||||
// lambda set vars are always freshly introduced in this annotation
|
||||
new_rigid_variables.extend(introduced_vars.lambda_sets.iter().map(|&v| Loc::at_zero(v)));
|
||||
let has_explicit_inference_variables = !introduced_vars.inferred.is_empty();
|
||||
|
||||
new_infer_variables.extend(introduced_vars.inferred.iter().copied());
|
||||
// ext-infer vars are always freshly introduced in this annotation
|
||||
new_infer_variables.extend(
|
||||
introduced_vars
|
||||
|
@ -3818,9 +3818,8 @@ fn instantiate_rigids(
|
|||
.iter()
|
||||
.map(|&v| Loc::at_zero(v)),
|
||||
);
|
||||
|
||||
let has_explicit_inference_variables = !introduced_vars.inferred.is_empty();
|
||||
new_infer_variables.extend(introduced_vars.inferred.iter().copied());
|
||||
// lambda set vars are always freshly introduced in this annotation
|
||||
new_infer_variables.extend(introduced_vars.lambda_sets.iter().map(|&v| Loc::at_zero(v)));
|
||||
|
||||
// Instantiate rigid variables
|
||||
if !rigid_substitution.is_empty() {
|
||||
|
@ -3900,12 +3899,8 @@ fn instantiate_rigids_simple(
|
|||
// wildcards are always freshly introduced in this annotation
|
||||
new_rigid_variables.extend(introduced_vars.wildcards.iter().copied());
|
||||
|
||||
// lambda set vars are always freshly introduced in this annotation
|
||||
new_rigid_variables.extend(introduced_vars.lambda_sets.iter().map(|&v| Loc::at_zero(v)));
|
||||
|
||||
let has_explicit_inference_variables = !introduced_vars.inferred.is_empty();
|
||||
let mut new_infer_variables: Vec<Loc<Variable>> = introduced_vars.inferred.clone();
|
||||
|
||||
// ext-infer vars are always freshly introduced in this annotation
|
||||
new_infer_variables.extend(
|
||||
introduced_vars
|
||||
|
@ -3913,6 +3908,8 @@ fn instantiate_rigids_simple(
|
|||
.iter()
|
||||
.map(|&v| Loc::at_zero(v)),
|
||||
);
|
||||
// lambda set vars are always freshly introduced in this annotation
|
||||
new_infer_variables.extend(introduced_vars.lambda_sets.iter().map(|&v| Loc::at_zero(v)));
|
||||
|
||||
// Instantiate rigid variables
|
||||
if !rigid_substitution.is_empty() {
|
||||
|
|
|
@ -7,7 +7,7 @@ main =
|
|||
# ^^^ a, Bool -[[foo(1)]]-> Str
|
||||
|
||||
bar = \_ -> foo {} Bool.true
|
||||
# ^^^ {}, Bool -[[]]-> Str
|
||||
# ^^^ {}, Bool -[[foo(1)]]-> Str
|
||||
|
||||
foo "" Bool.false
|
||||
# ^^^{inst} Str, Bool -[[foo(1)]]-> Str
|
||||
|
|
|
@ -5,8 +5,8 @@ main =
|
|||
|
||||
map : { f1: (I64 -> I64) } -> List I64
|
||||
map = \{ f1 } -> List.concat [f1 1] (map { f1 })
|
||||
# ^^^ { f1 : I64 -[[]]-> I64 } -[[map(2)]]-> List I64
|
||||
# ^^^ { f1 : I64 -[[]]-> I64 } -[[map(2)]]-> List I64
|
||||
# ^^^ { f1 : I64 -[[f(1)]]-> I64 } -[[map(2)]]-> List I64
|
||||
# ^^^ { f1 : I64 -[[f(1)]]-> I64 } -[[map(2)]]-> List I64
|
||||
|
||||
|
||||
map { f1: f }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue