Skip to content

Commit 971e3e9

Browse files
committed
[CSDiagnostics] Update test cases for variadic generic functions
1 parent 9276bb0 commit 971e3e9

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

test/Constraints/variadic_generic_functions.swift

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
22

33
func debugPrint<each T>(_ items: repeat each T)
44
where repeat each T: CustomDebugStringConvertible
@@ -83,25 +83,33 @@ do {
8383

8484
// apple/swift#69432 - Passing nil to a parameter pack fails to produce diagnostic for expression
8585
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'}}
8989

9090
foo(nil) // expected-error {{'nil' requires a contextual type}}
9191
foo(nil, 1) // expected-error {{'nil' requires a contextual type}}
9292
foo(2, nil) // expected-error {{'nil' requires a contextual type}}
9393

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'}}
9696

9797
bar(1, 2, 3, nil, "Hello", u: 3, w: 4, 8, nil) // expected-error {{'nil' requires a contextual type}}
9898
// expected-error@-1 {{'nil' requires a contextual type}}
9999

100100

101101
func fooWithOverload(_ value: Int) {}
102102
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'}}
104104

105105
fooWithOverload(0, 1, 2, 3, nil) // expected-error {{'nil' requires a contextual type}}
106106

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}}
107115
}

0 commit comments

Comments
 (0)