mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:51:07 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user