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
I cherry-picked 4c14407 to prevent merge
conflicts. I think these tests were updated by a subsequent PR. Rather than
cherry-picking more work, I just updated these tests since the change seemed
benign and that this kept the overall amount of cherry-picked commits small
(converting %$NUMBER to %kind$NUMBER for some ValueDecls).
Copy file name to clipboardExpand all lines: test/SILOptimizer/missing_returns.swift
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -10,29 +10,29 @@
10
10
11
11
structMissingGetterSubscript1{
12
12
subscript (i :Int)->Int{
13
-
} // expected-error {{missing return in getter expected to return 'Int'}}
13
+
} // expected-error {{missing return in getter for subscript expected to return 'Int'}}
14
14
}
15
15
16
16
// MARK: `decl/var/properties`
17
17
18
18
structX{}
19
19
20
-
varx13:X{} // expected-error {{missing return in getter expected to return 'X'}}
20
+
varx13:X{} // expected-error {{missing return in getter for var expected to return 'X'}}
21
21
22
22
structX14{}
23
23
extensionX14{
24
24
varx14:X{
25
-
} // expected-error {{missing return in getter expected to return 'X'}}
25
+
} // expected-error {{missing return in getter for property expected to return 'X'}}
26
26
}
27
27
28
28
// https://github.com/apple/swift/issues/57936
29
29
30
30
enumE1_57936{
31
-
varfoo:Int{} // expected-error{{missing return in getter expected to return 'Int'}}
31
+
varfoo:Int{} // expected-error{{missing return in getter for property expected to return 'Int'}}
32
32
}
33
33
34
34
enumE2_57936<T>{
35
-
varfoo:T{} // expected-error{{missing return in getter expected to return 'T'}}
35
+
varfoo:T{} // expected-error{{missing return in getter for property expected to return 'T'}}
36
36
}
37
37
38
38
// MARK: `decl/var/result_builders`
@@ -51,7 +51,7 @@ var fv_nop: () {
51
51
}
52
52
53
53
varfv_missing:String{
54
-
} // expected-error {{missing return in getter expected to return 'String'}}
54
+
} // expected-error {{missing return in getter for var expected to return 'String'}}
55
55
56
56
enumS_nop{
57
57
subscript()->(){
@@ -60,30 +60,30 @@ enum S_nop {
60
60
61
61
enumS_missing{
62
62
subscript()->String{
63
-
} // expected-error {{missing return in getter expected to return 'String'}}
63
+
} // expected-error {{missing return in getter for subscript expected to return 'String'}}
64
64
}
65
65
66
66
// MARK: `Sema/generic-subscript`
67
67
68
68
structS_generic_subscript_missing_return{
69
69
subscript<Value>(x:Int)->Value{
70
-
} // expected-error {{missing return in getter expected to return 'Value'}}
70
+
} // expected-error {{missing return in getter for subscript expected to return 'Value'}}
71
71
}
72
72
73
73
// MARK: New Test Cases
74
74
75
75
enumMyEmptyType{}
76
76
extensionMyEmptyType{
77
-
vari:Int{} // expected-error{{missing return in getter expected to return 'Int'}}
78
-
varn:MyEmptyType{} // expected-error{{getter with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
77
+
vari:Int{} // expected-error{{missing return in getter for property expected to return 'Int'}}
78
+
varn:MyEmptyType{} // expected-error{{getter for property with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
79
79
80
80
static subscript<A>(root:MyEmptyType)->A{}
81
81
82
82
subscript(_ e:MyEmptyType)->Int{}
83
83
subscript<T>(_ e:MyEmptyType)->T{}
84
-
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter expected to return 'Int'}}
85
-
subscript<T>(_ p:Int)->T{} // expected-error{{missing return in getter expected to return 'T'}}
86
-
subscript(_ i:Int)->Self{} // expected-error{{getter with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
84
+
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter for subscript expected to return 'Int'}}
85
+
subscript<T>(_ p:Int)->T{} // expected-error{{missing return in getter for subscript expected to return 'T'}}
86
+
subscript(_ i:Int)->Self{} // expected-error{{getter for subscript with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
vari:Int{} // expected-error{{missing return in getter expected to return 'Int'}}
101
-
varn:Never{} // expected-error{{getter with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
100
+
vari:Int{} // expected-error{{missing return in getter for property expected to return 'Int'}}
101
+
varn:Never{} // expected-error{{getter for property with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
102
102
103
103
static subscript<A>(root:Never)->A{}
104
104
105
105
subscript(_ n:Never)->Int{}
106
106
subscript<T>(_ e:Never)->T{}
107
-
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter expected to return 'Int'}}
108
-
subscript<T>(_ p:Int)->T{} // expected-error{{missing return in getter expected to return 'T'}}
109
-
subscript(_ i:Int)->Self{} // expected-error{{getter with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
107
+
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter for subscript expected to return 'Int'}}
108
+
subscript<T>(_ p:Int)->T{} // expected-error{{missing return in getter for subscript expected to return 'T'}}
109
+
subscript(_ i:Int)->Self{} // expected-error{{getter for subscript with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter expected to return 'Int'}}
131
+
subscript(_ i:Int)->Int{} // expected-error{{missing return in getter for subscript expected to return 'Int'}}
132
132
subscript(_ j:Int)->Void{}
133
-
subscript(_ k:Int)->Never{} // expected-error{{getter with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
133
+
subscript(_ k:Int)->Never{} // expected-error{{getter for subscript with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
134
134
// FIXME: ^ this diagnostic should probably use the word 'subscript' rather than 'getter'
0 commit comments