mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
b589f05c10
**Explanation**: We would like untyped throws to be available in Embedded Swift when system allocator is available. **Scope**: limited to Embedded Swift. **Risk**: low due to isolated scope, additive nature of the change, and no adoption of untyped throws in Embedded Swift so far. **Testing**: added new lit tests. **Issue**: rdar://171325402
36 lines
714 B
Swift
36 lines
714 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %{python} %utils/split_file.py -o %t %s
|
|
|
|
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
|
|
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o /dev/null
|
|
|
|
// REQUIRES: OS=macosx || OS=linux-gnu || OS=wasip1
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
// BEGIN MyModule.swift
|
|
|
|
public struct MyError: Error {
|
|
}
|
|
|
|
@inline(never)
|
|
public func foo<T>(_ t: T) throws {
|
|
throw MyError()
|
|
}
|
|
|
|
@inline(never)
|
|
public func callit<T>(_ t: T) {
|
|
do {
|
|
try foo(t)
|
|
} catch {
|
|
}
|
|
}
|
|
|
|
// BEGIN Main.swift
|
|
|
|
import MyModule
|
|
|
|
public func testit() {
|
|
callit(27)
|
|
}
|
|
|