mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 10:23:20 +00:00
fix: aliasing bug
This commit is contained in:
parent
d3678b1780
commit
fb26d6d80e
2 changed files with 11 additions and 4 deletions
|
@ -252,6 +252,13 @@ impl Context {
|
|||
self.erg_to_py_names
|
||||
.insert(ident.inspect().clone(), py_name.clone());
|
||||
}
|
||||
let ident = if cfg!(feature = "py_compatible") && py_name.is_some() {
|
||||
let mut symbol = ident.name.clone().into_token();
|
||||
symbol.content = py_name.clone().unwrap();
|
||||
Identifier::new(ident.vis.clone(), VarName::new(symbol))
|
||||
} else {
|
||||
ident.clone()
|
||||
};
|
||||
let vis = self.instantiate_vis_modifier(&ident.vis)?;
|
||||
// already defined as const
|
||||
if sig.is_const() {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl ASTLowerer {
|
|||
} else {
|
||||
self.module
|
||||
.context
|
||||
.assign_var_sig(&sig, found_body_t, id, py_name.clone())?;
|
||||
.assign_var_sig(&sig, found_body_t, id, None)?;
|
||||
}
|
||||
// FIXME: Identifier::new should be used
|
||||
let mut ident = hir::Identifier::bare(ident.clone());
|
||||
|
@ -551,7 +551,7 @@ impl ASTLowerer {
|
|||
};
|
||||
self.module.context.decls.insert(name, vi);
|
||||
}
|
||||
let ident = if cfg!(feature = "py_compatible") {
|
||||
let new_ident = if cfg!(feature = "py_compatible") {
|
||||
let mut symbol = ident.name.clone().into_token();
|
||||
symbol.content = py_name.clone();
|
||||
Identifier::new(ident.vis.clone(), VarName::new(symbol))
|
||||
|
@ -571,7 +571,7 @@ impl ASTLowerer {
|
|||
Some(TypeObj::Builtin(Type::Uninited)),
|
||||
None,
|
||||
);
|
||||
self.module.context.register_gen_type(&ident, ty_obj)?;
|
||||
self.module.context.register_gen_type(&new_ident, ty_obj)?;
|
||||
}
|
||||
Type::TraitType => {
|
||||
let ty_obj = GenTypeObj::trait_(
|
||||
|
@ -579,7 +579,7 @@ impl ASTLowerer {
|
|||
TypeObj::Builtin(Type::Uninited),
|
||||
None,
|
||||
);
|
||||
self.module.context.register_gen_type(&ident, ty_obj)?;
|
||||
self.module.context.register_gen_type(&new_ident, ty_obj)?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue