mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The backs out of some early decisions we made about actor layout that we don't need. Custom actors will use a different approach. This should suffice for the remainder of rdar://70146827.
46 lines
1.5 KiB
Swift
46 lines
1.5 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-module-path %t/a.swiftmodule -module-name a %s
|
|
// RUN: llvm-bcanalyzer -dump %t/a.swiftmodule | %FileCheck -check-prefix BC-CHECK %s
|
|
// RUN: %target-swift-ide-test -print-module -module-to-print a -source-filename x -I %t | %FileCheck -check-prefix MODULE-CHECK %s
|
|
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-module-path %t/b.swiftmodule -module-name a %t/a.swiftmodule
|
|
// RUN: cmp -s %t/a.swiftmodule %t/b.swiftmodule
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
///////////
|
|
// This test checks for correct serialization & deserialization of
|
|
// @actorIndependent and @actorIndependent(unsafe)
|
|
|
|
// look for correct annotation after first deserialization's module print:
|
|
|
|
// MODULE-CHECK: actor UnsafeCounter {
|
|
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) var storage: Int
|
|
// MODULE-CHECK-NEXT: @actorIndependent var count: Int
|
|
// MODULE-CHECK-NEXT: var actorCount: Int
|
|
// MODULE-CHECK-NEXT: init()
|
|
// MODULE-CHECK-NEXT: }
|
|
|
|
// and look for unsafe and safe versions of decl in BC dump:
|
|
|
|
// BC-CHECK-NOT: UnknownCode
|
|
// BC-CHECK: <ActorIndependent_DECL_ATTR abbrevid={{[0-9]+}} op0=1/>
|
|
// BC-CHECK: <ActorIndependent_DECL_ATTR abbrevid={{[0-9]+}} op0=0/>
|
|
|
|
|
|
actor UnsafeCounter {
|
|
|
|
@actorIndependent(unsafe)
|
|
private var storage : Int = 0
|
|
|
|
@actorIndependent
|
|
var count : Int {
|
|
get { storage }
|
|
set { storage = newValue }
|
|
}
|
|
|
|
var actorCount : Int {
|
|
get { storage }
|
|
set { storage = newValue }
|
|
}
|
|
}
|