Improve error message when shadowing builtin type

Closes #3109
This commit is contained in:
Ayaz Hafiz 2022-09-21 12:54:26 -05:00
parent ae122a0aea
commit 5f117be306
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
5 changed files with 90 additions and 62 deletions

View file

@ -284,14 +284,14 @@ impl Scope {
&mut self,
ident: &Ident,
region: Region,
) -> Result<Symbol, (Region, Loc<Ident>)> {
) -> Result<Symbol, (Symbol, Region, Loc<Ident>)> {
match self.introduce_help(ident.as_str(), region) {
Err((_, original_region)) => {
Err((symbol, original_region)) => {
let shadow = Loc {
value: ident.clone(),
region,
};
Err((original_region, shadow))
Err((symbol, original_region, shadow))
}
Ok(symbol) => Ok(symbol),
}