mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Add PendingDef::ShadowedAlias
This commit is contained in:
parent
ea91f06490
commit
9cead44b39
1 changed files with 14 additions and 9 deletions
|
@ -71,6 +71,8 @@ enum PendingDef<'a> {
|
||||||
vars: Vec<Located<Lowercase>>,
|
vars: Vec<Located<Lowercase>>,
|
||||||
ann: &'a Located<ast::TypeAnnotation<'a>>,
|
ann: &'a Located<ast::TypeAnnotation<'a>>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ShadowedAlias,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
@ -853,6 +855,11 @@ fn canonicalize_pending_def<'a>(
|
||||||
.introduced_variables
|
.introduced_variables
|
||||||
.union(&can_ann.introduced_variables);
|
.union(&can_ann.introduced_variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShadowedAlias => {
|
||||||
|
// Since this alias was shadowed, it gets ignored and has no
|
||||||
|
// effect on the output.
|
||||||
|
}
|
||||||
TypedBody(loc_pattern, loc_can_pattern, loc_ann, loc_expr) => {
|
TypedBody(loc_pattern, loc_can_pattern, loc_ann, loc_expr) => {
|
||||||
let ann =
|
let ann =
|
||||||
canonicalize_annotation(env, scope, &loc_ann.value, loc_ann.region, var_store);
|
canonicalize_annotation(env, scope, &loc_ann.value, loc_ann.region, var_store);
|
||||||
|
@ -1290,6 +1297,7 @@ fn to_pending_def<'a>(
|
||||||
|
|
||||||
Alias { name, vars, ann } => {
|
Alias { name, vars, ann } => {
|
||||||
let region = Region::span_across(&name.region, &ann.region);
|
let region = Region::span_across(&name.region, &ann.region);
|
||||||
|
|
||||||
match scope.introduce(
|
match scope.introduce(
|
||||||
name.value.into(),
|
name.value.into(),
|
||||||
&env.exposed_ident_ids,
|
&env.exposed_ident_ids,
|
||||||
|
@ -1326,16 +1334,13 @@ fn to_pending_def<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Err((original_region, shadow)) => {
|
Err((original_region, loc_shadowed_symbol)) => {
|
||||||
// env.problem(Problem::ShadowingInAnnotation {
|
env.problem(Problem::ShadowingInAnnotation {
|
||||||
// original_region,
|
original_region,
|
||||||
// shadow,
|
shadow: loc_shadowed_symbol,
|
||||||
// });
|
});
|
||||||
|
|
||||||
panic!(
|
PendingDef::ShadowedAlias
|
||||||
"TODO gracefully handle shadowing of type alias {:?}",
|
|
||||||
(original_region, shadow)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue