|
1 | 1 | // RUN: %empty-directory(%t)
|
2 | 2 | // RUN: %target-swift-frontend -enable-experimental-feature LayoutStringValueWitnesses -enable-type-layout -parse-stdlib -emit-module -emit-module-path=%t/layout_string_witnesses_types.swiftmodule %S/Inputs/layout_string_witnesses_types.swift
|
3 |
| -// RUN: %target-build-swift -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -c -parse-as-library -o %t/layout_string_witnesses_types.o %S/Inputs/layout_string_witnesses_types.swift |
| 3 | + |
| 4 | +// NOTE: We have to build this as dylib to turn private external symbols into local symbols, so we can observe potential issues with linkage |
| 5 | +// RUN: %target-build-swift-dylib(%t/%target-library-name(layout_string_witnesses_types)) -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -parse-as-library %S/Inputs/layout_string_witnesses_types.swift |
| 6 | +// RUN: %target-codesign %t/%target-library-name(layout_string_witnesses_types) |
4 | 7 | // RUN: %target-swift-frontend -enable-experimental-feature LayoutStringValueWitnesses -enable-library-evolution -emit-module -emit-module-path=%t/layout_string_witnesses_types_resilient.swiftmodule %S/Inputs/layout_string_witnesses_types_resilient.swift
|
5 | 8 | // RUN: %target-build-swift -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-library-evolution -c -parse-as-library -o %t/layout_string_witnesses_types_resilient.o %S/Inputs/layout_string_witnesses_types_resilient.swift
|
6 |
| -// RUN: %target-build-swift -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -module-name layout_string_witnesses_static %t/layout_string_witnesses_types.o %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s |
| 9 | +// RUN: %target-build-swift -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-type-layout -Xfrontend -parse-stdlib -module-name layout_string_witnesses_static -llayout_string_witnesses_types -L%t %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s %target-rpath(%t) |
7 | 10 | // RUN: %target-codesign %t/main
|
8 |
| -// RUN: %target-run %t/main | %FileCheck %s --check-prefix=CHECK -check-prefix=CHECK-%target-os |
| 11 | +// RUN: %target-run %t/main %t/%target-library-name(layout_string_witnesses_types) | %FileCheck %s --check-prefix=CHECK -check-prefix=CHECK-%target-os |
9 | 12 |
|
10 | 13 | // REQUIRES: executable_test
|
11 | 14 |
|
@@ -341,6 +344,39 @@ func testForwardToPayloadEnum() {
|
341 | 344 |
|
342 | 345 | testForwardToPayloadEnum()
|
343 | 346 |
|
| 347 | +struct InternalEnumWrapperWrapper { |
| 348 | + let x: InternalEnumWrapper |
| 349 | +} |
| 350 | + |
| 351 | +func testInternalEnumWrapper() { |
| 352 | + let ptr = UnsafeMutablePointer<InternalEnumWrapperWrapper>.allocate(capacity: 1) |
| 353 | + |
| 354 | + do { |
| 355 | + let x = InternalEnumWrapper(x: SimpleClass(x: 23)) |
| 356 | + testInit(ptr, to: .init(x: x)) |
| 357 | + } |
| 358 | + |
| 359 | + do { |
| 360 | + let y = InternalEnumWrapper(x: SimpleClass(x: 28)) |
| 361 | + |
| 362 | + // CHECK: Before deinit |
| 363 | + print("Before deinit") |
| 364 | + |
| 365 | + // CHECK-NEXT: SimpleClass deinitialized! |
| 366 | + testAssign(ptr, from: .init(x: y)) |
| 367 | + } |
| 368 | + |
| 369 | + // CHECK-NEXT: Before deinit |
| 370 | + print("Before deinit") |
| 371 | + |
| 372 | + // CHECK-NEXT: SimpleClass deinitialized! |
| 373 | + testDestroy(ptr) |
| 374 | + |
| 375 | + ptr.deallocate() |
| 376 | +} |
| 377 | + |
| 378 | +testInternalEnumWrapper() |
| 379 | + |
344 | 380 | #if os(macOS)
|
345 | 381 | func testObjc() {
|
346 | 382 | let ptr = UnsafeMutablePointer<ObjcWrapper>.allocate(capacity: 1)
|
|
0 commit comments