Allow checking to continue after 'impl as' outside class (#4937)

Currently it returns false which just ends typechecking. Instead handle
the error state later and avoid firing overlapping diagnostics in
'extend impl as'.

---------

Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
This commit is contained in:
Dana Jansens
2025-02-14 20:02:10 +00:00
committed by GitHub
co-authored by josh11b
parent 311b4ff03d
commit d5f3d3365a
9 changed files with 776 additions and 107 deletions
+5
View File
@@ -86,6 +86,11 @@ auto ImplWitnessForDeclaration(Context& context, const SemIR::Impl& impl)
-> SemIR::InstId {
CARBON_CHECK(!impl.has_definition_started());
auto self_type_id = context.types().GetTypeIdForTypeInstId(impl.self_id);
if (self_type_id == SemIR::ErrorInst::SingletonTypeId) {
// When 'impl as' is invalid, the self type is an error.
return SemIR::ErrorInst::SingletonInstId;
}
auto facet_type_id =
context.types().GetTypeIdForTypeInstId(impl.constraint_id);
if (facet_type_id == SemIR::ErrorInst::SingletonTypeId) {