Skip to content

Commit 7c1564a

Browse files
committed
Modified undeclared polymorph error in structures to mention the first encountered polymorph when multiple are missing
1 parent 4dfd6be commit 7c1564a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/resolve/type_definition/resolve.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ fn resolve_structure(
123123
let mut ok = Ok(());
124124
ty.kind.for_each_polymorph(&mut |name| {
125125
if structure.params.params.keys().filter(|n| *n == name).next().is_none() {
126-
ok = Err(ResolveError::other(format!("Cannot use polymorph '${}' inside type that is not declared by enclosing structure", name), ty.source));
126+
if ok.is_ok() {
127+
ok = Err(ResolveError::other(format!("Cannot use polymorph '${}' inside type that is not declared by enclosing structure", name), ty.source));
128+
}
127129
}
128130
});
129-
130131
ok?;
131132

132133
let resolved_struct = asg.structs.get_mut(struct_ref).expect("valid struct");

0 commit comments

Comments
 (0)