Skip to content

Commit f37ac3e

Browse files
committed
[NFC] Add a test that does not work with experimental associated type inference enabled
1 parent 38e48ac commit f37ac3e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

test/decl/protocol/req/associated_type_inference_fixed_type.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,3 +627,10 @@ do {
627627
struct Inner: P47 {}
628628
}
629629
}
630+
631+
protocol P48a { associatedtype A = Int }
632+
protocol P48b { associatedtype B }
633+
protocol P48c: P48a, P48b where A == B {}
634+
do {
635+
struct Conformer: P48c {}
636+
}

test/decl/protocol/req/associated_type_inference_fixed_type_experimental_inference.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,3 +871,24 @@ do {
871871
struct Inner: P47 {}
872872
}
873873
}
874+
875+
protocol P48a { associatedtype A = Int } // expected-note {{protocol requires nested type 'A'; do you want to add it?}}
876+
protocol P48b { associatedtype B } // expected-note {{protocol requires nested type 'B'; do you want to add it?}}
877+
protocol P48c: P48a, P48b where A == B {}
878+
do {
879+
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P48a: {
880+
// CHECK-NEXT: A => Self.B,
881+
// CHECK-NEXT: }
882+
883+
// CHECK-LABEL: Abstract type witness system for conformance of Conformer to P48b: {
884+
// CHECK-NEXT: B => Self.A,
885+
// CHECK-NEXT: }
886+
887+
// CHECK-NOT: Abstract type witness system for conformance of Conformer to P48c
888+
889+
// FIXME: Should compile
890+
struct Conformer: P48c {}
891+
// expected-error@-1 {{type 'Conformer' does not conform to protocol 'P48a'}}
892+
// expected-error@-2 {{type 'Conformer' does not conform to protocol 'P48b'}}
893+
// expected-error@-3 {{type 'Conformer' does not conform to protocol 'P48c'}}
894+
}

0 commit comments

Comments
 (0)