File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
validation-test/Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments