|
4 | 4 | // RUN: %target-codesign %t/%target-library-name(layout_string_witnesses_types)
|
5 | 5 | // RUN: %target-swift-frontend -target %target-future-triple -enable-experimental-feature LayoutStringValueWitnesses -enable-experimental-feature LayoutStringValueWitnessesInstantiation -enable-layout-string-value-witnesses -enable-layout-string-value-witnesses-instantiation -enable-library-evolution -enable-autolinking-runtime-compatibility-bytecode-layouts -emit-module -emit-module-path=%t/layout_string_witnesses_types_resilient.swiftmodule %S/Inputs/layout_string_witnesses_types_resilient.swift
|
6 | 6 | // RUN: %target-build-swift -target %target-future-triple -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnessesInstantiation -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-layout-string-value-witnesses-instantiation -Xfrontend -enable-library-evolution -c -parse-as-library -o %t/layout_string_witnesses_types_resilient.o %S/Inputs/layout_string_witnesses_types_resilient.swift
|
7 |
| -// RUN: %target-build-swift -target %target-future-triple -g -parse-stdlib -module-name layout_string_witnesses_dynamic -llayout_string_witnesses_types -L%t %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s %target-rpath(%t) |
| 7 | +// RUN: %target-build-swift -target %target-future-triple -g -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnesses -Xfrontend -enable-experimental-feature -Xfrontend LayoutStringValueWitnessesInstantiation -Xfrontend -enable-layout-string-value-witnesses -Xfrontend -enable-layout-string-value-witnesses-instantiation -parse-stdlib -module-name layout_string_witnesses_dynamic -llayout_string_witnesses_types -L%t %t/layout_string_witnesses_types_resilient.o -I %t -o %t/main %s %target-rpath(%t) |
8 | 8 | // RUN: %target-codesign %t/main
|
9 | 9 | // RUN: %target-run %t/main %t/%target-library-name(layout_string_witnesses_types) | %FileCheck %s --check-prefix=CHECK -check-prefix=CHECK-%target-os
|
10 | 10 |
|
@@ -1275,6 +1275,72 @@ func testNonCopyableGenericEnumSimpleClass() {
|
1275 | 1275 |
|
1276 | 1276 | testNonCopyableGenericEnumSimpleClass()
|
1277 | 1277 |
|
| 1278 | +public struct NonCopyableResilientWrapper: ~Copyable { |
| 1279 | + let x: SimpleResilient |
| 1280 | + let y: Int |
| 1281 | +} |
| 1282 | + |
| 1283 | +func testNonCopyableResilientStruct() { |
| 1284 | + let ptr = allocateInternalGenericPtr(of: NonCopyableResilientWrapper.self) |
| 1285 | + |
| 1286 | + do { |
| 1287 | + let x = TestClass() |
| 1288 | + testGenericInit(ptr, to: NonCopyableResilientWrapper(x: SimpleResilient(x: 23, y: x), y: 5)) |
| 1289 | + } |
| 1290 | + |
| 1291 | + do { |
| 1292 | + let y = TestClass() |
| 1293 | + // CHECK: Before deinit |
| 1294 | + print("Before deinit") |
| 1295 | + |
| 1296 | + // CHECK-NEXT: TestClass deinitialized! |
| 1297 | + testGenericAssign(ptr, from: NonCopyableResilientWrapper(x: SimpleResilient(x: 23, y: y), y: 7)) |
| 1298 | + } |
| 1299 | + |
| 1300 | + // CHECK-NEXT: Before deinit |
| 1301 | + print("Before deinit") |
| 1302 | + |
| 1303 | + // CHECK-NEXT: TestClass deinitialized! |
| 1304 | + testGenericDestroy(ptr, of: NonCopyableResilientWrapper.self) |
| 1305 | + |
| 1306 | + ptr.deallocate() |
| 1307 | +} |
| 1308 | + |
| 1309 | +testNonCopyableResilientStruct() |
| 1310 | + |
| 1311 | +public enum NonCopyableResilientEnum: ~Copyable { |
| 1312 | + case x(SimpleResilient, Int) |
| 1313 | + case y(Int) |
| 1314 | +} |
| 1315 | + |
| 1316 | +func testNonCopyableResilientEnum() { |
| 1317 | + let ptr = allocateInternalGenericPtr(of: NonCopyableResilientEnum.self) |
| 1318 | + |
| 1319 | + do { |
| 1320 | + let x = TestClass() |
| 1321 | + testGenericInit(ptr, to: NonCopyableResilientEnum.x(SimpleResilient(x: 23, y: x), 5)) |
| 1322 | + } |
| 1323 | + |
| 1324 | + do { |
| 1325 | + let y = TestClass() |
| 1326 | + // CHECK: Before deinit |
| 1327 | + print("Before deinit") |
| 1328 | + |
| 1329 | + // CHECK-NEXT: TestClass deinitialized! |
| 1330 | + testGenericAssign(ptr, from: NonCopyableResilientEnum.x(SimpleResilient(x: 23, y: y), 7)) |
| 1331 | + } |
| 1332 | + |
| 1333 | + // CHECK-NEXT: Before deinit |
| 1334 | + print("Before deinit") |
| 1335 | + |
| 1336 | + // CHECK-NEXT: TestClass deinitialized! |
| 1337 | + testGenericDestroy(ptr, of: NonCopyableResilientEnum.self) |
| 1338 | + |
| 1339 | + ptr.deallocate() |
| 1340 | +} |
| 1341 | + |
| 1342 | +testNonCopyableResilientEnum() |
| 1343 | + |
1278 | 1344 | #if os(macOS)
|
1279 | 1345 |
|
1280 | 1346 | import Foundation
|
|
0 commit comments