Skip to content

Commit 54155fe

Browse files
committed
Sema: Check generic requirements of parent context when realizing non-generic types
When realizing a type like Foo<A>.Bar, we have to account for the possibility that Bar is defined in a constrained extension of Foo, and has generic requirements beyond those that Foo itself places on 'A'. Previously we only handled this for types referenced from the constraint system as part of openUnboundGenericType(), so we were allowing invalid types through in type context. Add the right checking to applyGenericArguments() to close the hole. Note that the old code path still exists in the constraint solver; it is used for member accesses on metatype bases only. Fixes <https://bugs.swift.org/browse/SR-10466>.
1 parent 2d5d8e3 commit 54155fe

File tree

7 files changed

+134
-78
lines changed

7 files changed

+134
-78
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ Type ConstraintSystem::openUnboundGenericType(
629629
Type type, ConstraintLocatorBuilder locator) {
630630
assert(!type->getCanonicalType()->hasTypeParameter());
631631

632-
checkNestedTypeConstraints(*this, type, locator);
633-
634632
if (!type->hasUnboundGenericType())
635633
return type;
636634

@@ -988,6 +986,8 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
988986
TypeResolverContext::InExpression,
989987
/*isSpecialized=*/false);
990988

989+
checkNestedTypeConstraints(*this, type, locator);
990+
991991
// Open the type.
992992
type = openUnboundGenericType(type, locator);
993993

@@ -1241,6 +1241,9 @@ ConstraintSystem::getTypeOfMemberReference(
12411241

12421242
auto memberTy = TypeChecker::substMemberTypeWithBase(DC->getParentModule(),
12431243
typeDecl, baseObjTy);
1244+
1245+
checkNestedTypeConstraints(*this, memberTy, locator);
1246+
12441247
// Open the type if it was a reference to a generic type.
12451248
memberTy = openUnboundGenericType(memberTy, locator);
12461249

lib/Sema/TypeCheckType.cpp

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,60 @@ static bool isPointerToVoid(ASTContext &Ctx, Type Ty, bool &IsMutable) {
626626
return BGT->getGenericArgs().front()->isVoid();
627627
}
628628

629+
static Type checkConstrainedExtensionRequirements(Type type,
630+
SourceLoc loc,
631+
DeclContext *dc) {
632+
// Even if the type is not generic, it might be inside of a generic
633+
// context, so we need to check requirements.
634+
GenericTypeDecl *decl;
635+
Type parentTy;
636+
if (auto *aliasTy = dyn_cast<TypeAliasType>(type.getPointer())) {
637+
decl = aliasTy->getDecl();
638+
parentTy = aliasTy->getParent();
639+
} else if (auto *nominalTy = type->getAs<NominalType>()) {
640+
decl = nominalTy->getDecl();
641+
parentTy = nominalTy->getParent();
642+
} else {
643+
return type;
644+
}
645+
646+
// FIXME: Some day the type might also have its own 'where' clause, even
647+
// if its not generic.
648+
649+
auto *ext = dyn_cast<ExtensionDecl>(decl->getDeclContext());
650+
if (!ext || !ext->isConstrainedExtension())
651+
return type;
652+
653+
if (parentTy->hasUnboundGenericType() ||
654+
parentTy->hasTypeVariable()) {
655+
return type;
656+
}
657+
658+
auto subMap = parentTy->getContextSubstitutions(ext);
659+
660+
SourceLoc noteLoc = ext->getLoc();
661+
if (noteLoc.isInvalid())
662+
noteLoc = loc;
663+
664+
auto genericSig = ext->getGenericSignature();
665+
auto result =
666+
TypeChecker::checkGenericArguments(
667+
dc, loc, noteLoc, type,
668+
genericSig->getGenericParams(),
669+
genericSig->getRequirements(),
670+
QueryTypeSubstitutionMap{subMap},
671+
TypeChecker::LookUpConformance(dc),
672+
None);
673+
674+
switch (result) {
675+
case RequirementCheckResult::Failure:
676+
case RequirementCheckResult::SubstitutionFailure:
677+
return ErrorType::get(dc->getASTContext());
678+
case RequirementCheckResult::Success:
679+
return type;
680+
}
681+
}
682+
629683
static void diagnoseUnboundGenericType(Type ty, SourceLoc loc);
630684

631685
/// Apply generic arguments to the given type.
@@ -650,7 +704,9 @@ static Type applyGenericArguments(Type type,
650704
TypeResolution resolution,
651705
ComponentIdentTypeRepr *comp,
652706
TypeResolutionOptions options) {
707+
auto dc = resolution.getDeclContext();
653708
auto loc = comp->getIdLoc();
709+
654710
auto *generic = dyn_cast<GenericIdentTypeRepr>(comp);
655711
if (!generic) {
656712
if (type->is<UnboundGenericType>() &&
@@ -660,15 +716,17 @@ static Type applyGenericArguments(Type type,
660716
return ErrorType::get(type->getASTContext());
661717
}
662718

663-
return type;
719+
if (resolution.getStage() == TypeResolutionStage::Structural)
720+
return type;
721+
722+
return checkConstrainedExtensionRequirements(type, loc, dc);
664723
}
665724

666725
if (type->hasError()) {
667726
generic->setInvalid();
668727
return type;
669728
}
670729

671-
auto dc = resolution.getDeclContext();
672730
auto &ctx = dc->getASTContext();
673731
auto &diags = ctx.Diags;
674732

test/Constraints/conditionally_defined_types.swift

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Z2: AssociatedType {
1515
}
1616

1717
struct SameType<T> {}
18-
extension SameType where T == X { // expected-note 5 {{where 'T' = 'Y'}}
18+
extension SameType where T == X { // expected-note 13{{requirement specified as 'T' == 'X' [with T = Y]}}
1919
typealias TypeAlias1 = T
2020
typealias TypeAlias2 = Y
2121
typealias TypeAlias3<U> = (T, U) // expected-note {{requirement specified as 'T' == 'X' [with T = Y]}}
@@ -36,25 +36,24 @@ let _ = SameType<X>.Decl3.self
3636
let _ = SameType<X>.Decl4<X>.self
3737
let _ = SameType<X>.Decl5<X>.self
3838

39-
let _ = SameType<Y>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
40-
let _ = SameType<Y>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
39+
let _ = SameType<Y>.TypeAlias1.self // expected-error {{'SameType<Y>.TypeAlias1' (aka 'X') requires the types 'Y' and 'X' be equivalent}}
40+
let _ = SameType<Y>.TypeAlias2.self // expected-error {{'SameType<Y>.TypeAlias2' (aka 'Y') requires the types 'Y' and 'X' be equivalent}}
4141
let _ = SameType<Y>.TypeAlias3<X>.self // expected-error {{'SameType<Y>.TypeAlias3' requires the types 'Y' and 'X' be equivalent}}
42-
let _ = SameType<Y>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
43-
let _ = SameType<Y>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
44-
let _ = SameType<Y>.Decl3.self // expected-error {{referencing class 'Decl3' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
42+
let _ = SameType<Y>.Decl1.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
43+
let _ = SameType<Y>.Decl2.self // expected-error {{'SameType<Y>.Decl2' requires the types 'Y' and 'X' be equivalent}}
44+
let _ = SameType<Y>.Decl3.self // expected-error {{'SameType<Y>.Decl3' requires the types 'Y' and 'X' be equivalent}}
4545
let _ = SameType<Y>.Decl4<X>.self // expected-error {{'SameType<Y>.Decl4' requires the types 'Y' and 'X' be equivalent}}
4646
let _ = SameType<Y>.Decl5<X>.self // expected-error {{'SameType<Y>.Decl5' requires the types 'Y' and 'X' be equivalent}}
4747

48-
extension SameType: AssociatedType where T == X {} // expected-note {{where 'T' = 'Y'}}
49-
50-
// (Y first here, because there were issues caused by running associated type
51-
// inference for the first time)
52-
let _ = SameType<Y>.T.self // expected-error {{referencing type alias 'T' on 'SameType' requires the types 'Y' and 'X' be equivalent}}
48+
extension SameType: AssociatedType where T == X {}
49+
// expected-note@-1 {{requirement specified as 'T' == 'X' [with T = Y]}}
5350

5451
let _ = SameType<X>.T.self
52+
let _ = SameType<Y>.T.self // expected-error {{'SameType<Y>.T' (aka 'X') requires the types 'Y' and 'X' be equivalent}}
53+
5554

5655
struct Conforms<T> {}
57-
extension Conforms where T: P { // expected-note 5 {{where 'T' = 'Y'}}
56+
extension Conforms where T: P {
5857
typealias TypeAlias1 = T
5958
typealias TypeAlias2 = Y
6059
typealias TypeAlias3<U> = (T, U)
@@ -75,33 +74,33 @@ let _ = Conforms<X>.Decl3.self
7574
let _ = Conforms<X>.Decl4<X>.self
7675
let _ = Conforms<X>.Decl5<X>.self
7776

78-
let _ = Conforms<Y>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'Conforms' requires that 'Y' conform to 'P'}}
79-
let _ = Conforms<Y>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'Conforms' requires that 'Y' conform to 'P'}}
77+
let _ = Conforms<Y>.TypeAlias1.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
78+
let _ = Conforms<Y>.TypeAlias2.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8079
let _ = Conforms<Y>.TypeAlias3<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
81-
let _ = Conforms<Y>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'Conforms' requires that 'Y' conform to 'P'}}
82-
let _ = Conforms<Y>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'Conforms' requires that 'Y' conform to 'P'}}
83-
let _ = Conforms<Y>.Decl3.self // expected-error {{referencing class 'Decl3' on 'Conforms' requires that 'Y' conform to 'P'}}
80+
let _ = Conforms<Y>.Decl1.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
81+
let _ = Conforms<Y>.Decl2.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
82+
let _ = Conforms<Y>.Decl3.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8483
let _ = Conforms<Y>.Decl4<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8584
let _ = Conforms<Y>.Decl5<X>.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
8685

87-
extension Conforms: AssociatedType where T: P {} // expected-note {{where 'T' = 'Y'}}
86+
extension Conforms: AssociatedType where T: P {}
8887

89-
let _ = Conforms<Y>.T.self // expected-error {{referencing type alias 'T' on 'Conforms' requires that 'Y' conform to 'P'}}
88+
let _ = Conforms<Y>.T.self // expected-error {{type 'Y' does not conform to protocol 'P'}}
9089

9190
let _ = Conforms<X>.T.self
9291

9392
// Now, even more nesting!
9493

95-
extension SameType.Decl1 { // expected-note 5 {{where 'T' = 'Y'}}
94+
extension SameType.Decl1 {
9695
typealias TypeAlias1 = T
9796
typealias TypeAlias2 = Y
98-
typealias TypeAlias3<U> = (T, U) // expected-note {{requirement specified as 'T' == 'X' [with T = Y]}}
97+
typealias TypeAlias3<U> = (T, U)
9998

10099
struct Decl1 {}
101100
enum Decl2 {}
102101
class Decl3 {}
103-
struct Decl4<U> {} // expected-note {{requirement specified as 'T' == 'X' [with T = Y]}}
104-
enum Decl5<U: P> {} // expected-note {{requirement specified as 'T' == 'X' [with T = Y]}}
102+
struct Decl4<U> {}
103+
enum Decl5<U: P> {}
105104
}
106105

107106
let _ = SameType<X>.Decl1.TypeAlias1.self
@@ -113,16 +112,16 @@ let _ = SameType<X>.Decl1.Decl3.self
113112
let _ = SameType<X>.Decl1.Decl4<X>.self
114113
let _ = SameType<X>.Decl1.Decl5<X>.self
115114

116-
let _ = SameType<Y>.Decl1.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'SameType.Decl1' requires the types 'Y' and 'X' be equivalent}}
117-
let _ = SameType<Y>.Decl1.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'SameType.Decl1' requires the types 'Y' and 'X' be equivalent}}
118-
let _ = SameType<Y>.Decl1.TypeAlias3<X>.self // expected-error {{'SameType<Y>.Decl1.TypeAlias3' requires the types 'Y' and 'X' be equivalent}}
119-
let _ = SameType<Y>.Decl1.Decl1.self // expected-error {{referencing struct 'Decl1' on 'SameType.Decl1' requires the types 'Y' and 'X' be equivalent}}
120-
let _ = SameType<Y>.Decl1.Decl2.self // expected-error {{referencing enum 'Decl2' on 'SameType.Decl1' requires the types 'Y' and 'X' be equivalent}}
121-
let _ = SameType<Y>.Decl1.Decl3.self // expected-error {{referencing class 'Decl3' on 'SameType.Decl1' requires the types 'Y' and 'X' be equivalent}}
122-
let _ = SameType<Y>.Decl1.Decl4<X>.self // expected-error {{'SameType<Y>.Decl1.Decl4' requires the types 'Y' and 'X' be equivalent}}
123-
let _ = SameType<Y>.Decl1.Decl5<X>.self // expected-error {{'SameType<Y>.Decl1.Decl5' requires the types 'Y' and 'X' be equivalent}}
115+
let _ = SameType<Y>.Decl1.TypeAlias1.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
116+
let _ = SameType<Y>.Decl1.TypeAlias2.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
117+
let _ = SameType<Y>.Decl1.TypeAlias3<X>.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
118+
let _ = SameType<Y>.Decl1.Decl1.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
119+
let _ = SameType<Y>.Decl1.Decl2.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
120+
let _ = SameType<Y>.Decl1.Decl3.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
121+
let _ = SameType<Y>.Decl1.Decl4<X>.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
122+
let _ = SameType<Y>.Decl1.Decl5<X>.self // expected-error {{'SameType<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
124123

125-
extension SameType.Decl4 where U == X { // expected-note 5 {{where 'U' = 'Y'}}
124+
extension SameType.Decl4 where U == X { // expected-note 5 {{requirement specified as 'U' == 'X' [with U = Y]}}
126125
typealias TypeAlias1 = T
127126
typealias TypeAlias2 = Y
128127
typealias TypeAlias3<V> = (T, U, V) // expected-note {{requirement specified as 'U' == 'X' [with U = Y]}}
@@ -145,12 +144,12 @@ let _ = SameType<X>.Decl4<X>.Decl3.self
145144
let _ = SameType<X>.Decl4<X>.Decl4<X>.self
146145
let _ = SameType<X>.Decl4<X>.Decl5<X>.self
147146

148-
let _ = SameType<X>.Decl4<Y>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'SameType.Decl4' requires the types 'Y' and 'X' be equivalent}}
149-
let _ = SameType<X>.Decl4<Y>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'SameType.Decl4' requires the types 'Y' and 'X' be equivalent}}
147+
let _ = SameType<X>.Decl4<Y>.TypeAlias1.self // expected-error {{'SameType<X>.Decl4<Y>.TypeAlias1' (aka 'X') requires the types 'Y' and 'X' be equivalent}}
148+
let _ = SameType<X>.Decl4<Y>.TypeAlias2.self // expected-error {{'SameType<X>.Decl4<Y>.TypeAlias2' (aka 'Y') requires the types 'Y' and 'X' be equivalent}}
150149
let _ = SameType<X>.Decl4<Y>.TypeAlias3<X>.self // expected-error {{'SameType<X>.Decl4<Y>.TypeAlias3' requires the types 'Y' and 'X' be equivalent}}
151-
let _ = SameType<X>.Decl4<Y>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'SameType.Decl4' requires the types 'Y' and 'X' be equivalent}}
152-
let _ = SameType<X>.Decl4<Y>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'SameType.Decl4' requires the types 'Y' and 'X' be equivalent}}
153-
let _ = SameType<X>.Decl4<Y>.Decl3.self // expected-error {{referencing class 'Decl3' on 'SameType.Decl4' requires the types 'Y' and 'X' be equivalent}}
150+
let _ = SameType<X>.Decl4<Y>.Decl1.self // expected-error {{'SameType<X>.Decl4<Y>.Decl1' requires the types 'Y' and 'X' be equivalent}}
151+
let _ = SameType<X>.Decl4<Y>.Decl2.self // expected-error {{'SameType<X>.Decl4<Y>.Decl2' requires the types 'Y' and 'X' be equivalent}}
152+
let _ = SameType<X>.Decl4<Y>.Decl3.self // expected-error {{'SameType<X>.Decl4<Y>.Decl3' requires the types 'Y' and 'X' be equivalent}}
154153
let _ = SameType<X>.Decl4<Y>.Decl4<X>.self // expected-error {{'SameType<X>.Decl4<Y>.Decl4' requires the types 'Y' and 'X' be equivalent}}
155154
let _ = SameType<X>.Decl4<Y>.Decl5<X>.self // expected-error {{'SameType<X>.Decl4<Y>.Decl5' requires the types 'Y' and 'X' be equivalent}}
156155

@@ -174,9 +173,6 @@ let _ = SameType<Y>.Decl4<Y>.Decl5<X>.self // expected-error {{'SameType<Y>.Decl
174173

175174
// Finally, extra complicated:
176175
extension Conforms.Decl4 where U: AssociatedType, U.T: P {
177-
// expected-note@-1 5 {{where 'U' = 'Y'}}
178-
// expected-note@-2 5 {{'U.T' = 'Z2.T' (aka 'Y')}}
179-
// expected-note@-3 5 {{'U.T' = 'Y.T'}}
180176
typealias TypeAlias1 = T
181177
typealias TypeAlias2 = Y
182178
typealias TypeAlias3<V> = (T, U, V)
@@ -200,34 +196,29 @@ let _ = Conforms<X>.Decl4<Z1>.Decl5<X>.self
200196
// Two different forms of badness, corresponding to the two requirements:
201197

202198
let _ = Conforms<X>.Decl4<Y>.TypeAlias1.self
203-
// expected-error@-1 {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
204-
// expected-error@-2 {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
199+
// expected-error@-1 {{type 'Y' does not conform to protocol 'AssociatedType'}}
205200

206201
let _ = Conforms<X>.Decl4<Y>.TypeAlias2.self
207-
// expected-error@-1 {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
208-
// expected-error@-2 {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
202+
// expected-error@-1 {{type 'Y' does not conform to protocol 'AssociatedType'}}
209203

210204
let _ = Conforms<X>.Decl4<Y>.TypeAlias3<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
211205
let _ = Conforms<X>.Decl4<Y>.Decl1.self
212-
// expected-error@-1 {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
213-
// expected-error@-2 {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
206+
// expected-error@-1 {{type 'Y' does not conform to protocol 'AssociatedType'}}
214207

215208
let _ = Conforms<X>.Decl4<Y>.Decl2.self
216-
// expected-error@-1 {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
217-
// expected-error@-2 {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
209+
// expected-error@-1 {{type 'Y' does not conform to protocol 'AssociatedType'}}
218210

219211
let _ = Conforms<X>.Decl4<Y>.Decl3.self
220-
// expected-error@-1 {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Y.T' conform to 'P'}}
221-
// expected-error@-2 {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Y' conform to 'AssociatedType'}}
212+
// expected-error@-1 {{type 'Y' does not conform to protocol 'AssociatedType'}}
222213

223214
let _ = Conforms<X>.Decl4<Y>.Decl4<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
224215
let _ = Conforms<X>.Decl4<Y>.Decl5<X>.self // expected-error {{type 'Y' does not conform to protocol 'AssociatedType'}}
225216

226-
let _ = Conforms<X>.Decl4<Z2>.TypeAlias1.self // expected-error {{referencing type alias 'TypeAlias1' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
227-
let _ = Conforms<X>.Decl4<Z2>.TypeAlias2.self // expected-error {{referencing type alias 'TypeAlias2' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
217+
let _ = Conforms<X>.Decl4<Z2>.TypeAlias1.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
218+
let _ = Conforms<X>.Decl4<Z2>.TypeAlias2.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
228219
let _ = Conforms<X>.Decl4<Z2>.TypeAlias3<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
229-
let _ = Conforms<X>.Decl4<Z2>.Decl1.self // expected-error {{referencing struct 'Decl1' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
230-
let _ = Conforms<X>.Decl4<Z2>.Decl2.self // expected-error {{referencing enum 'Decl2' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
231-
let _ = Conforms<X>.Decl4<Z2>.Decl3.self // expected-error {{referencing class 'Decl3' on 'Conforms.Decl4' requires that 'Z2.T' (aka 'Y') conform to 'P'}}
220+
let _ = Conforms<X>.Decl4<Z2>.Decl1.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
221+
let _ = Conforms<X>.Decl4<Z2>.Decl2.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
222+
let _ = Conforms<X>.Decl4<Z2>.Decl3.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
232223
let _ = Conforms<X>.Decl4<Z2>.Decl4<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}
233224
let _ = Conforms<X>.Decl4<Z2>.Decl5<X>.self // expected-error {{type 'Z2.T' (aka 'Y') does not conform to protocol 'P'}}

0 commit comments

Comments
 (0)