Skip to content

Commit 08f8781

Browse files
committed
RequirementMachine: Don't drop errors on the floor with @objc protocols
1 parent 39ec990 commit 08f8781

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,10 @@ StructuralRequirementsRequest::evaluate(Evaluator &evaluator,
952952

953953
desugarRequirements(result, errors);
954954
expandDefaultRequirements(ctx, needsDefaultRequirements, result, errors);
955+
956+
diagnoseRequirementErrors(ctx, errors,
957+
AllowConcreteTypePolicy::NestedAssocTypes);
958+
955959
return ctx.AllocateCopy(result);
956960
}
957961

test/decl/protocol/objc.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,9 @@ class C8SubRW2: C8Base {
265265
@objc(custom:) func g(_: Any) // expected-warning {{method 'g' with Objective-C selector 'custom:' conflicts with method 'h()' with the same Objective-C selector; this is an error in Swift 6}}
266266
@objc(custom:) func h() async // expected-note 2 {{method 'h()' declared here}}
267267
}
268+
269+
// We forgot to emit diagnostics in the @objc path of StructuralRequirementsRequest.
270+
struct MyStruct {}
271+
272+
@objc protocol InvalidProtocol where Self: MyStruct {}
273+
// expected-error@-1 {{type 'Self' constrained to non-protocol, non-class type 'MyStruct'}}

0 commit comments

Comments
 (0)