Do not try to recover from using impl outside class error (#4755)

This prevents crashing when the wrongly used `impl` uses a poisoned
name.
#4622
This commit is contained in:
Boaz Brickner authored and GitHub committed 2025-01-03 20:20:35 +00:00
1 parent fa9d838270
commit 72e594dfd0
3 files changed
+149 -46

No files matched your search

+1
View File
@@ -102,6 +102,7 @@ auto HandleParseNode(Context& context, Parse::DefaultSelfImplAsId node_id)
"`impl as` can only be used in a class");
context.emitter().Emit(node_id, ImplAsOutsideClass);
self_type_id = SemIR::ErrorInst::SingletonTypeId;
return false;
}
// Build the implicit access to the enclosing `Self`.