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
2025-01-03 20:20:35 +00:00
committed by GitHub
parent fa9d838270
commit 72e594dfd0
3 changed files with 149 additions and 46 deletions
+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`.