Skip to content

Commit 91d0162

Browse files
authored
Merge pull request #13405 from rudkx/iuo-test-failable-init-and-static-fn
IUO: Add tests for failable init and static functions with IUO results.
2 parents d85d47a + b0f7909 commit 91d0162

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/Constraints/iuo.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ struct S {
1818
var m: Int
1919

2020
func fn() -> Int! { return i }
21+
static func static_fn() -> Int! { return 0 }
22+
23+
init(i: Int!, j: Int!, k: Int, m: Int) {
24+
self.i = i
25+
self.j = j
26+
self.k = k
27+
self.m = m
28+
}
29+
30+
init!() {
31+
i = 0
32+
j = 0
33+
k = 0
34+
m = 0
35+
}
2136
}
2237

2338
func takesStruct(s: S) {
@@ -37,6 +52,8 @@ _ = s.k
3752
s.m = 7
3853
s.j = 3
3954

55+
var s2: S = S()
56+
4057
struct T {
4158
let i: Float!
4259
var j: Float!
@@ -93,6 +110,10 @@ func forceMemberResult(s: S) -> Int {
93110
return s.fn()
94111
}
95112

113+
func forceStaticMemberResult() -> Int {
114+
return S.static_fn()
115+
}
116+
96117
func overloadedForceMemberResult() -> Int {
97118
return overloaded().fn()
98119
}

0 commit comments

Comments
 (0)