Skip to content

Commit 417828e

Browse files
committed
Add a test for typed throws and withUnsafe(Mutable)BufferPointer
1 parent 45a44a7 commit 417828e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/stdlib/ArrayTypedThrows.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
enum MyError: Error {
4+
case fail
5+
case bad
6+
}
7+
8+
func unsafeBuffers() throws(MyError) {
9+
var a = [1, 2, 3]
10+
try a.withUnsafeBufferPointer { (buffer) throws(MyError) in
11+
throw .bad
12+
}
13+
14+
try a.withUnsafeMutableBufferPointer { (buffer) throws(MyError) in
15+
throw .bad
16+
}
17+
}

0 commit comments

Comments
 (0)