iter 22b.2.7: fix — cycle termination guard, hoist type_repr
This commit is contained in:
@@ -575,15 +575,22 @@ fn build_registry(
|
||||
// step at the same type-hash.
|
||||
for (key, entry) in entries.iter() {
|
||||
let (class_name, type_hash) = key;
|
||||
let type_repr = type_head_name(&entry.instance.type_);
|
||||
// Iter 22b.2 leaves superclass-cycle detection to a future arm;
|
||||
// here we just terminate the walk.
|
||||
let mut visited: BTreeSet<&str> = BTreeSet::new();
|
||||
let mut current = class_by_name.get(class_name.as_str()).copied();
|
||||
while let Some(c) = current {
|
||||
if !visited.insert(c.name.as_str()) {
|
||||
break;
|
||||
}
|
||||
if let Some(sc) = &c.superclass {
|
||||
let sc_key = (sc.class.clone(), type_hash.clone());
|
||||
if !entries.contains_key(&sc_key) {
|
||||
return Err(WorkspaceLoadError::MissingSuperclassInstance {
|
||||
class: class_name.clone(),
|
||||
superclass: sc.class.clone(),
|
||||
type_repr: type_head_name(&entry.instance.type_),
|
||||
type_repr: type_repr.clone(),
|
||||
});
|
||||
}
|
||||
current = class_by_name.get(sc.class.as_str()).copied();
|
||||
|
||||
Reference in New Issue
Block a user