Skip to content

Commit 7e09101

Browse files
committed
[Tests] NFC: Add a test-case for rdar://116122902
(cherry picked from commit a90bd1c)
1 parent 92dbcb1 commit 7e09101

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol AnyValue {
4+
}
5+
6+
struct Value<T> {}
7+
8+
extension Value: AnyValue where T = { // expected-error {{use '==' for same-type requirements rather than '='}} expected-error {{expected type}}
9+
// expected-note@-1 {{requirement from conditional conformance of 'Value<T>' to 'AnyValue'}}
10+
}
11+
12+
struct Test {
13+
var tuple: (value: any AnyValue, id: Int)?
14+
15+
mutating func test<T>(v: Value<T>) {
16+
_ = {
17+
self.tuple = (v, 42)
18+
// expected-error@-1 {{cannot assign value of type '(Value<T>, Int)' to type '(value: any AnyValue, id: Int)'}}
19+
// expected-error@-2 {{generic struct 'Value' requires the types 'T' and '<<error type>>' be equivalent}}
20+
return 0
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)