Skip to content

Commit 731d605

Browse files
committed
Update two tests for 4c14407.
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).
1 parent f920aba commit 731d605

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

test/SILOptimizer/missing_returns.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@
1010

1111
struct MissingGetterSubscript1 {
1212
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'}}
1414
}
1515

1616
// MARK: `decl/var/properties`
1717

1818
struct X {}
1919

20-
var x13: X {} // expected-error {{missing return in getter expected to return 'X'}}
20+
var x13: X {} // expected-error {{missing return in getter for var expected to return 'X'}}
2121

2222
struct X14 {}
2323
extension X14 {
2424
var x14: 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'}}
2626
}
2727

2828
// https://github.com/apple/swift/issues/57936
2929

3030
enum E1_57936 {
31-
var foo: Int {} // expected-error{{missing return in getter expected to return 'Int'}}
31+
var foo: Int {} // expected-error{{missing return in getter for property expected to return 'Int'}}
3232
}
3333

3434
enum E2_57936<T> {
35-
var foo: T {} // expected-error{{missing return in getter expected to return 'T'}}
35+
var foo: T {} // expected-error{{missing return in getter for property expected to return 'T'}}
3636
}
3737

3838
// MARK: `decl/var/result_builders`
@@ -51,7 +51,7 @@ var fv_nop: () {
5151
}
5252

5353
var fv_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'}}
5555

5656
enum S_nop {
5757
subscript() -> () {
@@ -60,30 +60,30 @@ enum S_nop {
6060

6161
enum S_missing {
6262
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'}}
6464
}
6565

6666
// MARK: `Sema/generic-subscript`
6767

6868
struct S_generic_subscript_missing_return {
6969
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'}}
7171
}
7272

7373
// MARK: New Test Cases
7474

7575
enum MyEmptyType {}
7676
extension MyEmptyType {
77-
var i: Int {} // expected-error{{missing return in getter expected to return 'Int'}}
78-
var n: MyEmptyType {} // expected-error{{getter with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
77+
var i: Int {} // expected-error{{missing return in getter for property expected to return 'Int'}}
78+
var n: MyEmptyType {} // expected-error{{getter for property with uninhabited return type 'MyEmptyType' is missing call to another never-returning function on all paths}}
7979

8080
static subscript<A>(root: MyEmptyType) -> A {}
8181

8282
subscript(_ e: MyEmptyType) -> Int {}
8383
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}}
8787
subscript(_ s: Self) -> Self {}
8888

8989
static func unreachable_static_implicit_return(_ e: MyEmptyType) -> Int {}
@@ -97,16 +97,16 @@ extension MyEmptyType {
9797
}
9898

9999
extension Never {
100-
var i: Int {} // expected-error{{missing return in getter expected to return 'Int'}}
101-
var n: Never {} // expected-error{{getter with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
100+
var i: Int {} // expected-error{{missing return in getter for property expected to return 'Int'}}
101+
var n: Never {} // expected-error{{getter for property with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
102102

103103
static subscript<A>(root: Never) -> A {}
104104

105105
subscript(_ n: Never) -> Int {}
106106
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}}
110110
subscript(_ s: Self) -> Self {}
111111

112112
static func unreachable_static_implicit_return(_ n: Never) -> Int {}
@@ -128,8 +128,8 @@ enum InhabitedType {
128128
subscript(_ v: MyEmptyType, e: Int) -> Never {}
129129

130130
// Inhabited params
131-
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'}}
132132
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}}
134134
// FIXME: ^ this diagnostic should probably use the word 'subscript' rather than 'getter'
135135
}

test/SILOptimizer/return.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ struct S_56857 {
232232
if b {
233233
return 0
234234
}
235-
} // expected-error {{missing return in getter expected to return 'Int'}}
235+
} // expected-error {{missing return in getter for property expected to return 'Int'}}
236236

237237
var y: Int {
238238
get {
239239
if b {
240240
return 0
241241
}
242-
} // expected-error {{missing return in getter expected to return 'Int'}}
242+
} // expected-error {{missing return in getter for property expected to return 'Int'}}
243243
set {}
244244
}
245245
}

0 commit comments

Comments
 (0)