fix: user type renaming bug

This commit is contained in:
Shunsuke Shibayama 2023-09-06 19:36:48 +09:00
parent 2e0ee937fc
commit 6ca5e07191
2 changed files with 7 additions and 1 deletions

View file

@ -1329,7 +1329,7 @@ impl Context {
))
}
fn validate_visibility(
pub(crate) fn validate_visibility(
&self,
ident: &Identifier,
vi: &VarInfo,

View file

@ -551,12 +551,18 @@ impl Context {
}
}
if let Some((typ, _)) = self.get_type_and_ctx(ident.inspect()) {
if let Some((_, vi)) = self.get_var_info(ident.inspect()) {
self.inc_ref(ident.inspect(), vi, ident, self);
}
Ok(typ.clone())
} else if let Some(typ) = self
.consts
.get(ident.inspect())
.and_then(|v| self.convert_value_into_type(v.clone()).ok())
{
if let Some((_, vi)) = self.get_var_info(ident.inspect()) {
self.inc_ref(ident.inspect(), vi, ident, self);
}
Ok(typ)
} else if not_found_is_qvar {
let tyvar = named_free_var(Str::rc(other), self.level, Constraint::Uninited);