You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/SILGen/functions_uninhabited_param.swift
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
//===--- Function declaration with uninhabited parameter type
4
4
5
-
func foo(baz:Never)->Int{ // expected-note {{'baz' is uninhabited, so this function body can never be executed}}
5
+
func foo(baz:Never)->Int{ // expected-note {{'baz' is of type 'Never' which cannot be constructed because it is an enum with no cases}}
6
6
print("I can't be called!") // expected-warning{{will never be executed}}
7
7
return0
8
8
}
@@ -11,11 +11,11 @@ func bar(baz: Never) -> Int {} // ok
11
11
12
12
// SR-13432
13
13
func map<T>(_ block:(Never)->T){}
14
-
map{ arg in // expected-note {{'arg' is uninhabited, so this function body can never be executed}}
14
+
map{ arg in // expected-note {{'arg' is of type 'Never' which cannot be constructed because it is an enum with no cases}}
15
15
5 // expected-warning {{will never be executed}}
16
16
}
17
17
18
-
map{ arg in // expected-note {{'arg' is uninhabited, so this function body can never be executed}}
18
+
map{ arg in // expected-note {{'arg' is of type 'Never' which cannot be constructed because it is an enum with no cases}}
19
19
return5 // expected-warning {{will never be executed}}
20
20
}
21
21
@@ -26,4 +26,12 @@ enum E {
26
26
27
27
let _:(E.Type)->(E)->()={ s in{ e in s.f(e)}}
28
28
// expected-warning@-1 {{will never be executed}}
29
-
// expected-note@-2 {{'e' is uninhabited, so this function body can never be executed}}
29
+
// expected-note@-2 {{'e' is of type 'E' which cannot be constructed because it is an enum with no cases}}
30
+
31
+
func empty_product(_ xs:(Int,String,Never)){ // expected-note {{'xs' is of type '(Int, String, Never)' which cannot be constructed because it contains 'Never' which is an enum with no cases}}
32
+
print() // expected-warning{{will never be executed}}
33
+
}
34
+
func empty_custom_product(_ xs:(E,Int)){ // expected-note {{'xs' is of type '(E, Int)' which cannot be constructed because it contains 'E' which is an enum with no cases}}
35
+
print() // expected-warning{{will never be executed}}
0 commit comments