Skip to content

Commit 715ca9d

Browse files
committed
[AST] Store sugared requirements in NormalProtocolConformances.
No point in getting rid of the sugar so early.
1 parent 55d73e9 commit 715ca9d

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void NormalProtocolConformance::differenceAndStoreConditionalRequirements() {
407407
// Find the requirements in the extension that aren't proved by the original
408408
// type, these are the ones that make the conformance conditional.
409409
ConditionalRequirements =
410-
ctxt.AllocateCopy(canExtensionSig->requirementsNotSatisfiedBy(canTypeSig));
410+
ctxt.AllocateCopy(extensionSig->requirementsNotSatisfiedBy(typeSig));
411411
}
412412

413413
void NormalProtocolConformance::setSignatureConformances(

test/Generics/conditional_conformances.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func takes_P5<X: P5>(_: X) {}
3939
struct Free<T> {}
4040
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Free<T>
4141
// CHECK-NEXT: (normal_conformance type=Free<T> protocol=P2
42-
// CHECK-NEXT: conforms_to: τ_0_0 P1)
42+
// CHECK-NEXT: conforms_to: T P1)
4343
extension Free: P2 where T: P1 {}
4444
func free_good<U: P1>(_: U) {
4545
takes_P2(Free<U>())
@@ -54,7 +54,7 @@ func free_bad<U>(_: U) {
5454
struct Constrained<T: P1> {}
5555
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Constrained<T>
5656
// CHECK-NEXT: (normal_conformance type=Constrained<T> protocol=P2
57-
// CHECK-NEXT: conforms_to: τ_0_0 P3)
57+
// CHECK-NEXT: conforms_to: T P3)
5858
extension Constrained: P2 where T: P3 {}
5959
func constrained_good<U: P1 & P3>(_: U) {
6060
takes_P2(Constrained<U>())
@@ -79,7 +79,7 @@ extension RedundantSuper: P2 where T: P1 {}
7979
struct OverlappingSub<T: P1> {}
8080
// CHECK-LABEL: ExtensionDecl line={{.*}} base=OverlappingSub<T>
8181
// CHECK-NEXT: (normal_conformance type=OverlappingSub<T> protocol=P2
82-
// CHECK-NEXT: conforms_to: τ_0_0 P4)
82+
// CHECK-NEXT: conforms_to: T P4)
8383
extension OverlappingSub: P2 where T: P4 {}
8484
func overlapping_sub_good<U: P4>(_: U) {
8585
takes_P2(OverlappingSub<U>())
@@ -95,7 +95,7 @@ func overlapping_sub_bad<U: P1>(_: U) {
9595
struct SameType<T> {}
9696
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameType<Int>
9797
// CHECK-NEXT: (normal_conformance type=SameType<T> protocol=P2
98-
// CHECK-NEXT: same_type: τ_0_0 Int)
98+
// CHECK-NEXT: same_type: T Int)
9999
extension SameType: P2 where T == Int {}
100100
func same_type_good() {
101101
takes_P2(SameType<Int>())
@@ -109,7 +109,7 @@ func same_type_bad<U>(_: U) {
109109
struct SameTypeGeneric<T, U> {}
110110
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameTypeGeneric<T, T>
111111
// CHECK-NEXT: (normal_conformance type=SameTypeGeneric<T, U> protocol=P2
112-
// CHECK-NEXT: same_type: τ_0_0 τ_0_1)
112+
// CHECK-NEXT: same_type: T U)
113113
extension SameTypeGeneric: P2 where T == U {}
114114
func same_type_generic_good<U, V>(_: U, _: V)
115115
where U: Assoc, V: Assoc, U.AT == V.AT
@@ -131,8 +131,8 @@ func same_type_bad<U, V>(_: U, _: V) {
131131
struct Infer<T, U> {}
132132
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Infer<Constrained<U>, U>
133133
// CHECK-NEXT: (normal_conformance type=Infer<T, U> protocol=P2
134-
// CHECK-NEXT: same_type: τ_0_0 Constrained<τ_0_1>
135-
// CHECK-NEXT: conforms_to: τ_0_1 P1)
134+
// CHECK-NEXT: same_type: T Constrained<U>
135+
// CHECK-NEXT: conforms_to: U P1)
136136
extension Infer: P2 where T == Constrained<U> {}
137137
func infer_good<U: P1>(_: U) {
138138
takes_P2(Infer<Constrained<U>, U>())
@@ -147,7 +147,7 @@ func infer_bad<U: P1, V>(_: U, _: V) {
147147
struct InferRedundant<T, U: P1> {}
148148
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InferRedundant<Constrained<U>, U>
149149
// CHECK-NEXT: (normal_conformance type=InferRedundant<T, U> protocol=P2
150-
// CHECK-NEXT: same_type: τ_0_0 Constrained<τ_0_1>)
150+
// CHECK-NEXT: same_type: T Constrained<U>)
151151
extension InferRedundant: P2 where T == Constrained<U> {}
152152
func infer_redundant_good<U: P1>(_: U) {
153153
takes_P2(InferRedundant<Constrained<U>, U>())
@@ -167,7 +167,7 @@ class C3: C2 {}
167167
struct ClassFree<T> {}
168168
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassFree<T>
169169
// CHECK-NEXT: (normal_conformance type=ClassFree<T> protocol=P2
170-
// CHECK-NEXT: superclass: τ_0_0 C1)
170+
// CHECK-NEXT: superclass: T C1)
171171
extension ClassFree: P2 where T: C1 {}
172172
func class_free_good<U: C1>(_: U) {
173173
takes_P2(ClassFree<U>())
@@ -180,7 +180,7 @@ func class_free_bad<U>(_: U) {
180180
struct ClassMoreSpecific<T: C1> {}
181181
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassMoreSpecific<T>
182182
// CHECK-NEXT: (normal_conformance type=ClassMoreSpecific<T> protocol=P2
183-
// CHECK-NEXT: superclass: τ_0_0 C3)
183+
// CHECK-NEXT: superclass: T C3)
184184
extension ClassMoreSpecific: P2 where T: C3 {}
185185
func class_more_specific_good<U: C3>(_: U) {
186186
takes_P2(ClassMoreSpecific<U>())
@@ -216,11 +216,11 @@ func subclass_bad() {
216216
struct InheritEqual<T> {}
217217
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual<T>
218218
// CHECK-NEXT: (normal_conformance type=InheritEqual<T> protocol=P2
219-
// CHECK-NEXT: conforms_to: τ_0_0 P1)
219+
// CHECK-NEXT: conforms_to: T P1)
220220
extension InheritEqual: P2 where T: P1 {}
221221
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual<T>
222222
// CHECK-NEXT: (normal_conformance type=InheritEqual<T> protocol=P5
223-
// CHECK-NEXT: conforms_to: τ_0_0 P1)
223+
// CHECK-NEXT: conforms_to: T P1)
224224
extension InheritEqual: P5 where T: P1 {}
225225
func inheritequal_good<U: P1>(_: U) {
226226
takes_P2(InheritEqual<U>())
@@ -248,11 +248,11 @@ extension InheritLess: P5 {} // expected-error{{type 'T' does not conform to pro
248248
struct InheritMore<T> {}
249249
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore<T>
250250
// CHECK-NEXT: (normal_conformance type=InheritMore<T> protocol=P2
251-
// CHECK-NEXT: conforms_to: τ_0_0 P1)
251+
// CHECK-NEXT: conforms_to: T P1)
252252
extension InheritMore: P2 where T: P1 {}
253253
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore<T>
254254
// CHECK-NEXT: (normal_conformance type=InheritMore<T> protocol=P5
255-
// CHECK-NEXT: conforms_to: τ_0_0 P4)
255+
// CHECK-NEXT: conforms_to: T P4)
256256
extension InheritMore: P5 where T: P4 {}
257257
func inheritequal_good_good<U: P4>(_: U) {
258258
takes_P2(InheritMore<U>())
@@ -315,13 +315,13 @@ extension TwoDisjointConformances: P2 where T == String {}
315315
struct RedundancyOrderDependenceGood<T: P1, U> {}
316316
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceGood<T, T>
317317
// CHECK-NEXT: (normal_conformance type=RedundancyOrderDependenceGood<T, U> protocol=P2
318-
// CHECK-NEXT: same_type: τ_0_0 τ_0_1)
318+
// CHECK-NEXT: same_type: T U)
319319
extension RedundancyOrderDependenceGood: P2 where U: P1, T == U {}
320320
struct RedundancyOrderDependenceBad<T, U: P1> {}
321321
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceBad<T, T>
322322
// CHECK-NEXT: (normal_conformance type=RedundancyOrderDependenceBad<T, U> protocol=P2
323-
// CHECK-NEXT: conforms_to: τ_0_0 P1
324-
// CHECK-NEXT: same_type: τ_0_0 τ_0_1)
323+
// CHECK-NEXT: conforms_to: T P1
324+
// CHECK-NEXT: same_type: T U)
325325
extension RedundancyOrderDependenceBad: P2 where T: P1, T == U {}
326326

327327
// Checking of conditional requirements for existential conversions.

0 commit comments

Comments
 (0)