mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
cleanup
This commit is contained in:
parent
97b0e3df9b
commit
48b0bbe874
1 changed files with 12 additions and 19 deletions
|
@ -1659,33 +1659,26 @@ fn instantiate_rigids(
|
||||||
}
|
}
|
||||||
|
|
||||||
// wildcards are always freshly introduced in this annotation
|
// wildcards are always freshly introduced in this annotation
|
||||||
for (i, wildcard) in introduced_vars.wildcards.iter().enumerate() {
|
new_rigids.extend(introduced_vars.wildcards.iter().copied());
|
||||||
ftv.insert(format!("*{}", i).into(), *wildcard);
|
|
||||||
new_rigids.push(*wildcard);
|
// inferred vars are always freshly introduced in this annotation
|
||||||
}
|
new_rigids.extend(introduced_vars.inferred.iter().copied());
|
||||||
|
|
||||||
// lambda set vars are always freshly introduced in this annotation
|
// lambda set vars are always freshly introduced in this annotation
|
||||||
for var in introduced_vars.lambda_sets.iter() {
|
new_rigids.extend(introduced_vars.lambda_sets.iter().copied());
|
||||||
new_rigids.push(*var);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lambda set vars are always freshly introduced in this annotation
|
|
||||||
for var in introduced_vars.inferred.iter() {
|
|
||||||
new_rigids.push(*var);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Instantiate rigid variables
|
// Instantiate rigid variables
|
||||||
if !rigid_substitution.is_empty() {
|
if !rigid_substitution.is_empty() {
|
||||||
annotation.substitute(&rigid_substitution);
|
annotation.substitute(&rigid_substitution);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(new_headers) = crate::pattern::headers_from_annotation(
|
let loc_annotation_ref = Loc::at(loc_pattern.region, &annotation);
|
||||||
&loc_pattern.value,
|
if let Pattern::Identifier(symbol) = loc_pattern.value {
|
||||||
&Loc::at(loc_pattern.region, &annotation),
|
headers.insert(symbol, Loc::at(loc_pattern.region, annotation.clone()));
|
||||||
) {
|
} else if let Some(new_headers) =
|
||||||
for (symbol, loc_type) in new_headers {
|
crate::pattern::headers_from_annotation(&loc_pattern.value, &loc_annotation_ref)
|
||||||
headers.insert(symbol, loc_type);
|
{
|
||||||
}
|
headers.extend(new_headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
annotation
|
annotation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue