1
- // RUN: %target-typecheck-verify-swift
1
+ // RUN: %target-typecheck-verify-swift -disable-availability-checking
2
2
3
3
func debugPrint< each T > ( _ items: repeat each T )
4
4
where repeat each T : CustomDebugStringConvertible
83
83
84
84
// apple/swift#69432 - Passing nil to a parameter pack fails to produce diagnostic for expression
85
85
do {
86
- func foo< each T > ( _ value: repeat each T ) { } // expected-note {{in inferring pack element #1 of 'value'}}
87
- // expected-note@-1 {{in inferring pack element #1 of 'value'}}
88
- // expected-note@-2 {{in inferring pack element #2 of 'value'}}
86
+ func foo< each T > ( _ value: repeat each T ) { } // expected-note {{in inferring pack element #0 of 'value'}}
87
+ // expected-note@-1 {{in inferring pack element #0 of 'value'}}
88
+ // expected-note@-2 {{in inferring pack element #1 of 'value'}}
89
89
90
90
foo ( nil ) // expected-error {{'nil' requires a contextual type}}
91
91
foo ( nil , 1 ) // expected-error {{'nil' requires a contextual type}}
92
92
foo ( 2 , nil ) // expected-error {{'nil' requires a contextual type}}
93
93
94
- func bar< each T , U, each W > ( _ t: repeat each T , u: U , w: repeat each W ) { } // expected-note {{in inferring pack element #3 of 'w'}}
95
- // expected-note@-1 {{in inferring pack element #4 of 't'}}
94
+ func bar< each T , U, each W > ( _ t: repeat each T , u: U , w: repeat each W ) { } // expected-note {{in inferring pack element #2 of 'w'}}
95
+ // expected-note@-1 {{in inferring pack element #3 of 't'}}
96
96
97
97
bar ( 1 , 2 , 3 , nil , " Hello " , u: 3 , w: 4 , 8 , nil ) // expected-error {{'nil' requires a contextual type}}
98
98
// expected-error@-1 {{'nil' requires a contextual type}}
99
99
100
100
101
101
func fooWithOverload( _ value: Int ) { }
102
102
func fooWithOverload< each T > ( _ value: repeat each T ) { }
103
- // expected-note@-1 {{in inferring pack element #5 of 'value'}}
103
+ // expected-note@-1 {{in inferring pack element #4 of 'value'}}
104
104
105
105
fooWithOverload ( 0 , 1 , 2 , 3 , nil ) // expected-error {{'nil' requires a contextual type}}
106
106
107
+ struct Foo < each T > {
108
+ init ( _ value: repeat each T ) { }
109
+ // expected-note@-1 {{in inferring pack element #0 of 'value'}}
110
+ // expected-note@-2 {{in inferring pack element #0 of 'value'}}
111
+ }
112
+
113
+ _ = Foo ( nil ) // expected-error {{'nil' requires a contextual type}}
114
+ _ = Foo ( nil , 1 ) // expected-error {{'nil' requires a contextual type}}
107
115
}
0 commit comments