File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ void SILGenModule::useConformance(ProtocolConformanceRef conformanceRef) {
3333 // If the conformance is invalid, crash deterministically even in noassert
3434 // builds.
3535 if (conformanceRef.isInvalid ()) {
36+ // When lazy type checking is enabled, a conformance may only be diagnosed
37+ // as invalid during SILGen. Ignore it instead of asserting.
38+ auto &ctx = getASTContext ();
39+ if (ctx.TypeCheckerOpts .EnableLazyTypecheck && ctx.hadError ())
40+ return ;
41+
3642 llvm::report_fatal_error (" Invalid conformance in type-checked AST" );
3743 }
3844
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ public protocol Proto {
77 func req( )
88}
99
10- public struct ConformsToProtoMissingRequirement : Proto {
11- // expected-error@-1 {{type 'ConformsToProtoMissingRequirement ' does not conform to protocol 'Proto'}}
10+ public struct ConformsToProto_MissingRequirement : Proto {
11+ // expected-error@-1 {{type 'ConformsToProto_MissingRequirement ' does not conform to protocol 'Proto'}}
1212}
1313
14- public struct ConformsToProtoNearMiss : Proto {
15- // expected-error@-1 {{type 'ConformsToProtoNearMiss ' does not conform to protocol 'Proto'}}
14+ public struct ConformsToProto_NearMiss : Proto {
15+ // expected-error@-1 {{type 'ConformsToProto_NearMiss ' does not conform to protocol 'Proto'}}
1616
1717 public func req( x: Int ) { }
1818}
@@ -21,8 +21,16 @@ public protocol ProtoWithAssociatedType {
2121 associatedtype A
2222}
2323
24- public struct ConformsToProtoProtoWithAssociatedType : ProtoWithAssociatedType {
25- // expected-error@-1 {{type 'ConformsToProtoProtoWithAssociatedType' does not conform to protocol 'ProtoWithAssociatedType'}}
24+ public struct ConformsToProtoWithAssociatedType_MissingTypeRequirement : ProtoWithAssociatedType {
25+ // expected-error@-1 {{type 'ConformsToProtoWithAssociatedType_MissingTypeRequirement' does not conform to protocol 'ProtoWithAssociatedType'}}
26+ }
27+
28+ public protocol ProtoWithConstrainedAssociatedType {
29+ associatedtype A : Proto
30+ }
31+
32+ public struct ConformsToProtoWithConstrainedAssociatedType_MissingTypeRequirement : ProtoWithConstrainedAssociatedType {
33+ // expected-error@-1 {{type 'ConformsToProtoWithConstrainedAssociatedType_MissingTypeRequirement' does not conform to protocol 'ProtoWithConstrainedAssociatedType'}}
2634}
2735
2836public struct GenericStruct < T> {
You can’t perform that action at this time.
0 commit comments