Skip to content

Commit 731c516

Browse files
Suyash SrijanSuyash Srijan
authored andcommitted
[test] update tests
1 parent 8f79bb8 commit 731c516

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/stmt/statements.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,20 @@ func throwingFuncInDefer1() throws {
378378
}
379379

380380
func throwingFuncInDefer2() throws {
381+
defer { throwingFunctionCalledInDefer() } // expected-error {{errors cannot be thrown out of a defer body}}
382+
print("Bar")
383+
}
384+
385+
func throwingFuncInDefer3() {
381386
defer { try throwingFunctionCalledInDefer() } // expected-error {{errors cannot be thrown out of a defer body}}
382387
print("Bar")
383388
}
384389

390+
func throwingFuncInDefer4() {
391+
defer { throwingFunctionCalledInDefer() } // expected-error {{errors cannot be thrown out of a defer body}}
392+
print("Bar")
393+
}
394+
385395
func throwingFunctionCalledInDefer() throws {
386396
throw DeferThrowError.someError
387397
}

0 commit comments

Comments
 (0)