nac3core: fix broken top level test due to hashmap order
This commit is contained in:
parent
5a1a8ecee3
commit
2ce507964c
@ -43,7 +43,12 @@ impl TopLevelDef {
|
||||
"Function {{\nname: {:?},\nsig: {:?},\nvar_id: {:?}\n}}",
|
||||
name,
|
||||
unifier.stringify(*signature, obj_to_name, var_to_name),
|
||||
var_id
|
||||
{
|
||||
// NOTE: preserve the order for debug output and test
|
||||
let mut r = var_id.clone();
|
||||
r.sort_unstable();
|
||||
r
|
||||
}
|
||||
),
|
||||
TopLevelDef::Initializer { class_id } => format!("Initializer {{ {:?} }}", class_id),
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ impl TopLevelComposer {
|
||||
}
|
||||
|
||||
println!("type_var_to_concrete_def3: {:?}\n", type_var_to_concrete_def);
|
||||
|
||||
|
||||
// unification of previously assigned typevar
|
||||
for (ty, def) in type_var_to_concrete_def {
|
||||
println!(
|
||||
@ -864,8 +864,7 @@ impl TopLevelComposer {
|
||||
)?
|
||||
};
|
||||
// find type vars within this method parameter type annotation
|
||||
let type_vars_within =
|
||||
get_type_var_contained_in_type_annotation(&type_ann);
|
||||
let type_vars_within = get_type_var_contained_in_type_annotation(&type_ann);
|
||||
// handle the class type var and the method type var
|
||||
for type_var_within in type_vars_within {
|
||||
if let TypeAnnotation::TypeVarKind(ty) = type_var_within {
|
||||
@ -987,7 +986,7 @@ impl TopLevelComposer {
|
||||
unreachable!("must be type var annotation");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: allow class have field which type refers to Self type?
|
||||
type_var_to_concrete_def
|
||||
.insert(dummy_field_type, annotation);
|
||||
|
@ -342,7 +342,7 @@ fn test_simple_class_analyze(source: Vec<&str>, res: Vec<&str>) {
|
||||
let tvar_v = composer
|
||||
.unifier
|
||||
.get_fresh_var_with_range(&[composer.primitives_ty.bool, composer.primitives_ty.int32]);
|
||||
|
||||
|
||||
println!("t: {}, {:?}", tvar_t.1, tvar_t.0);
|
||||
println!("v: {}, {:?}\n", tvar_v.1, tvar_v.0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user