Skip to content

Commit 92a78c4

Browse files
committed
RequirementMachine: Update remaining tests for requirement machine diagnostics
A handful of cases where we emit a bogus redundancy warning are marked with 'FIXME(rqm-diagnostics)'.
1 parent f4cb13f commit 92a78c4

9 files changed

+75
-72
lines changed

test/AutoDiff/Sema/differentiable_func_type.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -typecheck -verify %s -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify
1+
// RUN: %target-swift-frontend -typecheck -verify %s -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on
22

33
import _Differentiation
44

@@ -188,8 +188,6 @@ extension Vector: Differentiable where T: Differentiable {
188188
// expected-note@+1 2 {{found this candidate}}
189189
func inferredConformancesGeneric<T, U>(_: @differentiable(reverse) (Vector<T>) -> Vector<U>) {}
190190

191-
// expected-error @+4 {{generic signature requires types 'Vector<T>' and 'Vector<T>.TangentVector' to be the same}}
192-
// expected-error @+3 {{generic signature requires types 'Vector<U>' and 'Vector<U>.TangentVector' to be the same}}
193191
// expected-error @+2 {{parameter type 'Vector<T>' does not conform to 'Differentiable' and satisfy 'Vector<T> == Vector<T>.TangentVector', but the enclosing function type is '@differentiable(_linear)'}}
194192
// expected-error @+1 {{result type 'Vector<U>' does not conform to 'Differentiable' and satisfy 'Vector<U> == Vector<U>.TangentVector', but the enclosing function type is '@differentiable(_linear)'}}
195193
func inferredConformancesGenericLinear<T, U>(_: @differentiable(_linear) (Vector<T>) -> Vector<U>) {}
@@ -209,8 +207,6 @@ func diff(x: Vector<Float>) -> Vector<Float> {}
209207
inferredConformancesGeneric(diff) // okay!
210208

211209
func inferredConformancesGenericResult<T, U>() -> @differentiable(reverse) (Vector<T>) -> Vector<U> {}
212-
// expected-error @+4 {{generic signature requires types 'Vector<T>' and 'Vector<T>.TangentVector' to be the same}}
213-
// expected-error @+3 {{generic signature requires types 'Vector<U>' and 'Vector<U>.TangentVector' to be the same}}
214210
// expected-error @+2 {{parameter type 'Vector<T>' does not conform to 'Differentiable' and satisfy 'Vector<T> == Vector<T>.TangentVector', but the enclosing function type is '@differentiable(_linear)'}}
215211
// expected-error @+1 {{result type 'Vector<U>' does not conform to 'Differentiable' and satisfy 'Vector<U> == Vector<U>.TangentVector', but the enclosing function type is '@differentiable(_linear)'}}
216212
func inferredConformancesGenericResultLinear<T, U>() -> @differentiable(_linear) (Vector<T>) -> Vector<U> {}

test/Constraints/same_types.swift

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=off
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on
22
// RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-inferred-signatures=on 2>&1 | %FileCheck %s
33

44
protocol Fooable {
@@ -57,29 +57,26 @@ func test2a<T: Fooable, U: Fooable>(_ t: T, u: U) -> (X, X)
5757
// CHECK-NEXT: Generic signature: <T, U where T : Fooable, U : Fooable, T.[Fooable]Foo == X, U.[Fooable]Foo == X>
5858
func test3<T: Fooable, U: Fooable>(_ t: T, u: U) -> (X, X)
5959
where T.Foo == X, U.Foo == X, T.Foo == U.Foo {
60-
// expected-warning@-1{{redundant same-type constraint 'U.Foo' == 'X'}}
61-
// expected-note@-2{{same-type constraint 'T.Foo' == 'X' written here}}
60+
// expected-warning@-1{{redundant same-type constraint 'T.Foo' == 'X'}}
6261
return (t.foo, u.foo)
6362
}
6463

6564
// CHECK-LABEL: same_types.(file).fail1(_:u:)@
6665
// CHECK-NEXT: Generic signature: <T, U where T : Fooable, U : Fooable, T.[Fooable]Foo == U.[Fooable]Foo>
67-
func fail1<
66+
func fail1< // expected-error{{no type for 'T.Foo' can satisfy both 'T.Foo == X' and 'T.Foo == Y'}}
6867
T: Fooable, U: Fooable
6968
>(_ t: T, u: U) -> (X, Y)
70-
where T.Foo == X, U.Foo == Y, T.Foo == U.Foo { // expected-error{{'U.Foo' cannot be equal to both 'Y' and 'X'}}
71-
// expected-note@-1{{same-type constraint 'T.Foo' == 'X' written here}}
72-
return (t.foo, u.foo) // expected-error{{cannot convert return expression of type '(X, X)' to return type '(X, Y)'}}
69+
where T.Foo == X, U.Foo == Y, T.Foo == U.Foo {
70+
return (t.foo, u.foo) // expected-error{{cannot convert return expression of type '(T.Foo, T.Foo)' to return type '(X, Y)'}}
7371
}
7472

7573
// CHECK-LABEL: same_types.(file).fail2(_:u:)@
7674
// CHECK-NEXT: Generic signature: <T, U where T : Fooable, U : Fooable, T.[Fooable]Foo == U.[Fooable]Foo>
77-
func fail2<
75+
func fail2< // expected-error{{no type for 'T.Foo' can satisfy both 'T.Foo == Y' and 'T.Foo == X'}}
7876
T: Fooable, U: Fooable
7977
>(_ t: T, u: U) -> (X, Y)
80-
where T.Foo == U.Foo, T.Foo == X, U.Foo == Y { // expected-error{{'U.Foo' cannot be equal to both 'Y' and 'X'}}
81-
// expected-note@-1{{same-type constraint 'T.Foo' == 'X' written here}}
82-
return (t.foo, u.foo) // expected-error{{cannot convert return expression of type '(X, X)' to return type '(X, Y)'}}
78+
where T.Foo == U.Foo, T.Foo == X, U.Foo == Y {
79+
return (t.foo, u.foo) // expected-error{{cannot convert return expression of type '(T.Foo, T.Foo)' to return type '(X, Y)'}}
8380
}
8481

8582
func test4<T: Barrable>(_ t: T) -> Y where T.Bar == Y {
@@ -88,8 +85,8 @@ func test4<T: Barrable>(_ t: T) -> Y where T.Bar == Y {
8885

8986
// CHECK-LABEL: same_types.(file).fail3@
9087
// CHECK-NEXT: Generic signature: <T where T : Barrable>
91-
func fail3<T: Barrable>(_ t: T) -> X
92-
where T.Bar == X { // expected-error {{'X' does not conform to required protocol 'Fooable'}}
88+
func fail3<T: Barrable>(_ t: T) -> X // expected-error {{no type for 'T.Bar' can satisfy both 'T.Bar == X' and 'T.Bar : Fooable'}}
89+
where T.Bar == X {
9390
return t.bar // expected-error{{cannot convert return expression of type 'T.Bar' }}
9491
}
9592

@@ -104,7 +101,7 @@ func test6<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y {
104101
// CHECK-LABEL: same_types.(file).test7@
105102
// CHECK-NEXT: Generic signature: <T where T : Barrable, T.[Barrable]Bar == Y>
106103
func test7<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y, T.Bar.Foo == X {
107-
// expected-warning@-1{{neither type in same-type constraint ('Y.Foo' (aka 'X') or 'X') refers to a generic parameter or associated type}}
104+
// expected-warning@-1{{redundant same-type constraint 'Y.Foo' (aka 'X') == 'X'}}
108105
return (t.bar, t.bar.foo)
109106
}
110107

@@ -121,31 +118,31 @@ func fail4<T: Barrable>(_ t: T) -> (Y, Z)
121118
// CHECK-NEXT: Generic signature: <T where T : Barrable, T.[Barrable]Bar == Y>
122119
func fail5<T: Barrable>(_ t: T) -> (Y, Z)
123120
where
124-
T.Bar.Foo == Z, // expected-note{{same-type constraint 'T.Bar.Foo' == 'Z' written here}}
125-
T.Bar == Y { // expected-error{{'T.Bar.Foo' cannot be equal to both 'Y.Foo' (aka 'X') and 'Z'}}
121+
T.Bar.Foo == Z, // expected-error{{generic signature requires types 'Y.Foo' (aka 'X') and 'Z' to be the same}}
122+
T.Bar == Y {
126123
return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type '(Y, X)' to return type '(Y, Z)'}}
127124
}
128125

129126
// CHECK-LABEL: same_types.(file).test8@
130127
// CHECK-NEXT: Generic signature: <T where T : Fooable>
131-
func test8<T: Fooable>(_ t: T)
132-
where T.Foo == X, // expected-note{{same-type constraint 'T.Foo' == 'X' written here}}
133-
T.Foo == Y {} // expected-error{{'T.Foo' cannot be equal to both 'Y' and 'X'}}
128+
func test8<T: Fooable>(_ t: T) // expected-error{{no type for 'T.Foo' can satisfy both 'T.Foo == Y' and 'T.Foo == X'}}
129+
where T.Foo == X,
130+
T.Foo == Y {}
134131

135132

136133
func testAssocTypeEquivalence<T: Fooable>(_ fooable: T) -> X.Type
137134
where T.Foo == X {
138135
return T.Foo.self
139136
}
140137

141-
func fail6<T>(_ t: T) -> Int where T == Int { // expected-error{{same-type requirement makes generic parameter 'T' non-generic}}
138+
func fail6<T>(_ t: T) -> Int where T == Int { // expected-warning{{same-type requirement makes generic parameter 'T' non-generic}}
142139
return t
143140
}
144141

145142
// CHECK-LABEL: same_types.(file).test8(_:u:)@
146143
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
147144
func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
148-
where T.Bar == Y, // expected-note{{same-type constraint 'U.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
145+
where T.Bar == Y,
149146
U.Bar.Foo == X, T.Bar == U.Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
150147
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
151148
}
@@ -154,7 +151,7 @@ func test8<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
154151
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
155152
func test8a<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
156153
where
157-
T.Bar == Y, // expected-note{{same-type constraint 'U.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
154+
T.Bar == Y,
158155
U.Bar.Foo == X, U.Bar == T.Bar { // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
159156
return (t.bar, u.bar, t.bar.foo, u.bar.foo)
160157
}
@@ -163,7 +160,7 @@ func test8a<T: Barrable, U: Barrable>(_ t: T, u: U) -> (Y, Y, X, X)
163160
// CHECK-NEXT: Generic signature: <T, U where T : Barrable, U : Barrable, T.[Barrable]Bar == Y, U.[Barrable]Bar == Y>
164161
func test8b<T: Barrable, U: Barrable>(_ t: T, u: U)
165162
where U.Bar.Foo == X, // expected-warning{{redundant same-type constraint 'U.Bar.Foo' == 'X'}}
166-
T.Bar == Y, // expected-note{{same-type constraint 'U.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
163+
T.Bar == Y,
167164
T.Bar == U.Bar {
168165
}
169166

@@ -207,7 +204,8 @@ S1<Q>().foo(x: 1, y: 2)
207204
struct S2<T : P> where T.A == T.B {
208205
// CHECK-LABEL: same_types.(file).S2.foo(x:y:)@
209206
// CHECK-NEXT: <T, X, Y where T : P, X == Y, Y == T.[P]A, T.[P]A == T.[P]B>
210-
func foo<X, Y>(x: X, y: Y) where X == T.A, Y == T.B { // expected-error{{same-type requirement makes generic parameters 'X' and 'Y' equivalent}}
207+
func foo<X, Y>(x: X, y: Y) where X == T.A, Y == T.B { // expected-warning{{same-type requirement makes generic parameters 'Y' and 'X' equivalent}}
208+
// expected-warning@-1 {{redundant same-type constraint 'X' == 'T.A'}}
211209
print(X.self)
212210
print(Y.self)
213211
print(x)
@@ -219,7 +217,7 @@ S2<Q>().foo(x: 1, y: 2)
219217
struct S3<T : P> {
220218
// CHECK-LABEL: same_types.(file).S3.foo(x:y:)@
221219
// CHECK-NEXT: <T, X, Y where T : P, X == Y, Y == T.[P]A>
222-
func foo<X, Y>(x: X, y: Y) where X == T.A, Y == T.A {} // expected-error{{same-type requirement makes generic parameters 'X' and 'Y' equivalent}}
220+
func foo<X, Y>(x: X, y: Y) where X == T.A, Y == T.A {} // expected-warning{{same-type requirement makes generic parameters 'Y' and 'X' equivalent}}
223221
}
224222
S3<Q>().foo(x: 1, y: 2)
225223

@@ -262,25 +260,25 @@ protocol P1 {
262260
// CHECK-NEXT: Generic signature: <A, B, T, U, V, W where A : P1, B : P1, T == V, U == W, A.[P1]Assoc == X1<T, U>, B.[P1]Assoc == X1<T, U>>
263261
func structuralSameType1<A: P1, B: P1, T, U, V, W>(_: A, _: B, _: T, _: U, _: V, _: W)
264262
where A.Assoc == X1<T, U>, B.Assoc == X1<V, W>, A.Assoc == B.Assoc { }
265-
// expected-error@-1{{same-type requirement makes generic parameters 'T' and 'V' equivalent}}
266-
// expected-error@-2{{same-type requirement makes generic parameters 'U' and 'W' equivalent}}
263+
// expected-warning@-2{{same-type requirement makes generic parameters 'V' and 'T' equivalent}}
264+
// expected-warning@-3{{same-type requirement makes generic parameters 'W' and 'U' equivalent}}
267265

268266
typealias Tuple2<T, U> = (T, U)
269267

270268
// CHECK-LABEL: same_types.(file).structuralSameType2@
271269
// CHECK-NEXT: Generic signature: <A, B, T, U, V, W where A : P1, B : P1, T == V, U == W, A.[P1]Assoc == (T, U), B.[P1]Assoc == (T, U)>
272270
func structuralSameType2<A: P1, B: P1, T, U, V, W>(_: A, _: B, _: T, _: U, _: V, _: W)
273271
where A.Assoc == Tuple2<T, U>, B.Assoc == Tuple2<V, W>, A.Assoc == B.Assoc { }
274-
// expected-error@-1{{same-type requirement makes generic parameters 'T' and 'V' equivalent}}
275-
// expected-error@-2{{same-type requirement makes generic parameters 'U' and 'W' equivalent}}
272+
// expected-warning@-2{{same-type requirement makes generic parameters 'V' and 'T' equivalent}}
273+
// expected-warning@-3{{same-type requirement makes generic parameters 'W' and 'U' equivalent}}
276274

277275
// CHECK-LABEL: same_types.(file).structuralSameType3@
278276
// CHECK-NEXT: Generic signature: <T, U, V, W where T == V, U == W>
279277
func structuralSameType3<T, U, V, W>(_: T, _: U, _: V, _: W)
280278
where X1<T, U> == X1<V, W> { }
281-
// expected-error@-1{{same-type requirement makes generic parameters 'T' and 'V' equivalent}}
282-
// expected-error@-2{{same-type requirement makes generic parameters 'U' and 'W' equivalent}}
283-
// expected-warning@-3{{neither type in same-type constraint ('X1<T, U>' or 'X1<V, W>') refers to a generic parameter or associated type}}
279+
// expected-warning@-2{{same-type requirement makes generic parameters 'V' and 'T' equivalent}}
280+
// expected-warning@-3{{same-type requirement makes generic parameters 'W' and 'U' equivalent}}
281+
// expected-warning@-3{{redundant same-type constraint 'X1<T, U>' == 'X1<V, W>'}}
284282

285283
protocol P2 {
286284
associatedtype Assoc1
@@ -289,8 +287,13 @@ protocol P2 {
289287

290288
// CHECK-LABEL: same_types.(file).structuralSameTypeRecursive1@
291289
// CHECK-NEXT: Generic signature: <T, U>
290+
291+
// expected-error@+2 {{cannot build rewrite system for generic signature; concrete nesting limit exceeded}}
292+
// expected-note@+1 {{failed rewrite rule is τ_0_0.[P2:Assoc1].[concrete: ((((((((((((((((((((((((((((((τ_0_0.[P2:Assoc1], τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1), τ_0_1)] => τ_0_0.[P2:Assoc1]}}
292293
func structuralSameTypeRecursive1<T: P2, U>(_: T, _: U)
293-
where T.Assoc1 == Tuple2<T.Assoc1, U> // expected-error{{same-type constraint 'T.Assoc1' == '(T.Assoc1, U)' is recursive}}
294+
where T.Assoc1 == Tuple2<T.Assoc1, U>
295+
// expected-error@-1 {{'Assoc1' is not a member type of type 'T'}}
296+
// expected-error@-2 {{'Assoc1' is not a member type of type 'T'}}
294297
{ }
295298

296299
protocol P3 {
@@ -302,7 +305,7 @@ protocol P4 {
302305

303306
// CHECK-LABEL: same_types.(file).test9@
304307
// CHECK-NEXT: Generic signature: <T where T : P4>
305-
func test9<T>(_: T) where T.A == X, T: P4, T.A: P3 { } // expected-error{{same-type constraint type 'X' does not conform to required protocol 'P3'}}
308+
func test9<T>(_: T) where T.A == X, T: P4, T.A: P3 { } // expected-error{{no type for 'T.A' can satisfy both 'T.A == X' and 'T.A : P3'}}
306309

307310
// Same-type constraint conflict through protocol where clauses.
308311
protocol P5 where Foo1 == Foo2 {
@@ -320,9 +323,9 @@ struct X5b { }
320323

321324
// CHECK-LABEL: same_types.(file).test9(_:u:)@
322325
// CHECK-NEXT: Generic signature: <T, U where T : P6, U : P6, T.[P6]Bar == U.[P6]Bar>
323-
func test9<T: P6, U: P6>(_ t: T, u: U)
324-
where T.Bar.Foo1 == X5a, // expected-note{{same-type constraint 'T.Bar.Foo1' == 'X5a' written here}}
325-
U.Bar.Foo2 == X5b, // expected-error{{'U.Bar.Foo2' cannot be equal to both 'X5b' and 'X5a'}}
326+
func test9<T: P6, U: P6>(_ t: T, u: U) // expected-error{{no type for 'T.Bar.Foo1' can satisfy both 'T.Bar.Foo1 == X5a' and 'T.Bar.Foo1 == X5b'}}
327+
where T.Bar.Foo1 == X5a,
328+
U.Bar.Foo2 == X5b,
326329
T.Bar == U.Bar {
327330
}
328331

@@ -333,14 +336,14 @@ func test9<T: P6, U: P6>(_ t: T, u: U)
333336
// CHECK-NEXT: Generic signature: <T, U where T == U>
334337
func testMetatypeSameType<T, U>(_ t: T, _ u: U)
335338
where T.Type == U.Type { }
336-
// expected-error@-1{{same-type requirement makes generic parameters 'T' and 'U' equivalent}}
337-
// expected-warning@-2{{neither type in same-type constraint ('T.Type' or 'U.Type') refers to a generic parameter or associated type}}
339+
// expected-warning@-2{{same-type requirement makes generic parameters 'U' and 'T' equivalent}}
340+
// expected-warning@-2{{redundant same-type constraint 'T.Type' == 'U.Type'}}
338341

339342
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity1@
340343
// CHECK-NEXT: Generic signature: <U, T where U == T.Type>
341344
func testSameTypeCommutativity1<U, T>(_ t: T, _ u: U)
342345
where T.Type == U { } // Equivalent to U == T.Type
343-
// expected-error@-1{{same-type requirement makes generic parameter 'U' non-generic}}
346+
// expected-warning@-2{{same-type requirement makes generic parameter 'U' non-generic}}
344347

345348
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity2@
346349
// CHECK-NEXT: Generic signature: <U, T where T : P1, T.[P1]Assoc == U?>
@@ -356,7 +359,7 @@ func testSameTypeCommutativity3<U, T: P1>(_ t: T, _ u: U)
356359
// CHECK-NEXT: Generic signature: <U, T where T == (U) -> ()>
357360
func testSameTypeCommutativity4<U, T>(_ t: T, _ u: U)
358361
where (U) -> () == T { } // Equivalent to T == (U) -> ()
359-
// expected-error@-1{{same-type requirement makes generic parameter 'T' non-generic}}
362+
// expected-warning@-2{{same-type requirement makes generic parameter 'T' non-generic}}
360363

361364
// CHECK-LABEL: same_types.(file).testSameTypeCommutativity5@
362365
// CHECK-NEXT: Generic signature: <U, T where T : P1, T.[P1]Assoc == P3 & PPP>
@@ -381,8 +384,6 @@ struct Bar<A: P1, B: P1> where A.Assoc == B.Assoc {
381384
// CHECK-LABEL: same_types.(file).Bar.f(with:)@
382385
// CHECK-NEXT: Generic signature: <A, B, C where A : P1, B : P1, C : P1, A.[P1]Assoc == B.[P1]Assoc, B.[P1]Assoc == C.[P1]Assoc>
383386
func f<C: P1>(with other: C) -> Foo<A, B, C> where A.Assoc == C.Assoc {
384-
// expected-note@-1 {{previous same-type constraint 'B.Assoc' == 'C.Assoc' inferred from type here}}
385-
// expected-warning@-2 {{redundant same-type constraint 'A.Assoc' == 'C.Assoc'}}
386387
fatalError()
387388
}
388389
}

test/Generics/associated_type_typo.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on
22

3-
// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures %s -requirement-machine-protocol-signatures=verify -requirement-machine-inferred-signatures=verify > %t.dump 2>&1
3+
// RUN: not %target-swift-frontend -typecheck -debug-generic-signatures %s -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on > %t.dump 2>&1
44
// RUN: %FileCheck -check-prefix CHECK-GENERIC %s < %t.dump
55

66
protocol P1 {
@@ -62,8 +62,9 @@ protocol Pattern {
6262

6363
// FIXME: This works for all of the wrong reasons, but it is correct that
6464
// it works.
65+
// FIXME(rqm-diagnostics): Bogus warning here.
6566
func matched<C: Indexable>(atStartOf c: C)
66-
where Element_<C> == Element
67+
where Element_<C> == Element // expected-warning {{redundant same-type constraint 'Element_<C>' (aka 'C.Iterator.Element') == 'Self.Element'}}
6768
, Element_<C.Slice> == Element
6869
}
6970

test/Generics/conditional_requirement_inference_in_protocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on
22
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on -requirement-machine-inferred-signatures=on 2>&1 | %FileCheck %s
33

4-
// FIXME: The redundant conformance warnings here should not be emitted, since
4+
// FIXME(rqm-diagnostics): The redundant conformance warnings here should not be emitted, since
55
// these requirements participate in conditional requirement inference.
66

77
// CHECK-LABEL: conditional_requirement_inference_in_protocol.(file).Good@

test/Generics/deduction.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ struct StaticFuncs {
172172
}
173173

174174
struct StaticFuncsGeneric<U> {
175-
// FIXME: Nested generics are very broken
176-
// static func chameleon<T>() -> T {}
175+
static func chameleon<T>() -> T {}
177176
}
178177

179178
func chameleon<T>() -> T {}
@@ -182,10 +181,10 @@ func testStatic(_ sf: StaticFuncs, sfi: StaticFuncsGeneric<Int>) {
182181
var x: Int16
183182
x = StaticFuncs.chameleon()
184183
x = sf.chameleon2()
185-
// FIXME: Nested generics are very broken
186-
// x = sfi.chameleon()
187-
// typealias SFI = StaticFuncsGeneric<Int>
188-
// x = SFI.chameleon()
184+
185+
x = sfi.chameleon() // expected-error {{static member 'chameleon' cannot be used on instance of type 'StaticFuncsGeneric<Int>'}}
186+
typealias SFI = StaticFuncsGeneric<Int>
187+
x = SFI.chameleon()
189188
_ = x
190189
}
191190

test/Generics/interdependent_protocol_conformance_example_3.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public protocol MultiPoint {
1919

2020
typealias P = Self.C.P
2121
// expected-warning@-1 {{redundant same-type constraint 'Self.P' == 'Self.C.P'}}
22-
// FIXME: This is bogus
22+
// FIXME(rqm-diagnostics): This is bogus
2323

2424
associatedtype X: NonEmptyProtocol
2525
where X.C: NonEmptyProtocol,

0 commit comments

Comments
 (0)