[test][wasm] Add test to kill the missing func addr reservation

This commit is contained in:
Yuta Saito
2025-09-15 14:26:08 +00:00
parent e12642f917
commit 5431bb115b
2 changed files with 47 additions and 1 deletions

View File

@@ -745,3 +745,45 @@ func reproduction<T: Init>(_ x: Int, _ y: Int, _ t: T) {
// CHECK: there is no byte
reproduction(2, 3, TrailingByte())
do {
// regression test for https://github.com/swiftlang/swift-driver/pull/1987
@inline(never) func blackhole<T>(_ t: T) { }
final class Context {
func doSomething() {}
deinit {
print("Context deinit")
}
}
enum MyOptional<Value> {
case some(Value)
case none
}
final class _GenericStorage<Value> {
let value: MyOptional<Value>
init(value: Value) {
self.value = .some(value)
}
func unwrapAndCopy() {
if case .some(let value) = value {
blackhole(value)
}
}
}
let test = _GenericStorage(
value: Context().doSomething,
)
// CHECK: test.unwrapAndCopy
print("test.unwrapAndCopy")
test.unwrapAndCopy()
// CHECK: test.unwrapAndCopy
print("test.unwrapAndCopy")
test.unwrapAndCopy()
// CHECK: Context deinit
}

View File

@@ -191,7 +191,11 @@ class WasmStdlib(cmake_product.CMakeProduct):
# Test configuration
self.cmake_options.define('SWIFT_INCLUDE_TESTS:BOOL', 'TRUE')
self.cmake_options.define('SWIFT_ENABLE_SOURCEKIT_TESTS:BOOL', 'FALSE')
lit_test_paths = ['IRGen', 'stdlib', 'Concurrency/Runtime', 'embedded']
lit_test_paths = [
'IRGen', 'stdlib', 'Concurrency/Runtime', 'embedded',
# TODO(katei): Enable all interpreter tests
'Interpreter/enum.swift',
]
lit_test_paths = [os.path.join(
self.build_dir, 'test-wasi-wasm32', path) for path in lit_test_paths]
self.cmake_options.define('SWIFT_LIT_TEST_PATHS:STRING',