Skip to content

Commit 8b80331

Browse files
committed
Updating tests to use actor
This patch updates the `actor class` spelling to `actor` in almost all of the tests. There are places where I verify that we sanely handle `actor` as an attribute though. These include: - test/decl/class/actor/basic.swift - test/decl/protocol/special/Actor.swift - test/SourceKit/CursorInfo/cursor_info_concurrency.swift - test/attr/attr_objc_async.swift - test/ModuleInterface/actor_protocol.swift
1 parent 748f15e commit 8b80331

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+170
-121
lines changed

test/ClangImporter/objc_async.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func testSlowServerOldSchool(slowServer: SlowServer) {
7171
// Check import of attributes
7272
func globalAsync() async { }
7373

74-
actor class MySubclassCheckingSwiftAttributes : ProtocolWithSwiftAttributes {
74+
actor MySubclassCheckingSwiftAttributes : ProtocolWithSwiftAttributes {
7575
func syncMethod() { } // expected-note 2{{calls to instance method 'syncMethod()' from outside of its actor context are implicitly asynchronous}}
7676

7777
func independentMethod() {

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Darwin
1313
import Glibc
1414
#endif
1515

16-
actor class Counter {
16+
actor Counter {
1717
private var value = 0
1818
private let scratchBuffer: UnsafeMutableBufferPointer<Int>
1919

test/Concurrency/Runtime/mainactor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func checkIfMainQueue(expectedAnswer expected: Bool) -> Bool {
2626
return true
2727
}
2828

29-
actor class A {
29+
actor A {
3030
func onCorrectQueue(_ count : Int) -> Int {
3131
if checkIfMainQueue(expectedAnswer: false) {
3232
print("on actor instance's queue")

test/Concurrency/actor_call_implicitly_async.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22
// REQUIRES: concurrency
33

4-
actor class BankAccount {
4+
actor BankAccount {
55

66
private var curBalance : Int
77

@@ -61,7 +61,7 @@ actor class BankAccount {
6161
_ = deposit(withdraw(deposit(withdraw(balance()))))
6262
}
6363

64-
} // end actor class
64+
} // end actor
6565

6666
func someAsyncFunc() async {
6767
let deposit1 = 120, deposit2 = 45
@@ -136,7 +136,7 @@ func regularFunc() {
136136
}
137137

138138

139-
actor class TestActor {}
139+
actor TestActor {}
140140

141141
@globalActor
142142
struct BananaActor {
@@ -189,7 +189,7 @@ func blender(_ peeler : () -> Void) {
189189
///////////
190190
// check various curried applications to ensure we mark the right expression.
191191

192-
actor class Calculator {
192+
actor Calculator {
193193
func addCurried(_ x : Int) -> ((Int) -> Int) {
194194
return { (_ y : Int) in x + y }
195195
}
@@ -214,4 +214,4 @@ actor class Calculator {
214214

215215
let plusOne = await calc.addCurried(await calc.add(0, 1))
216216
let _ = plusOne(2)
217-
}
217+
}

test/Concurrency/actor_inout_isolation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Point {
2222
}
2323
}
2424

25-
actor class TestActor {
25+
actor TestActor {
2626
// expected-note@+1{{mutable state is only available within the actor instance}}
2727
var position = Point(x: 0, y: 0)
2828
var nextPosition = Point(x: 0, y: 1)
@@ -122,7 +122,7 @@ extension TestActor {
122122
}
123123

124124
// Check implicit async testing
125-
actor class DifferentActor {
125+
actor DifferentActor {
126126
func modify(_ state: inout Int) {}
127127
}
128128

@@ -144,7 +144,7 @@ extension TestActor {
144144
}
145145
}
146146

147-
actor class MyActor {
147+
actor MyActor {
148148
var points: [Point] = []
149149
var int: Int = 0
150150
var maybeInt: Int?

test/Concurrency/actor_isolation.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func acceptEscapingAsyncClosure<T>(_: @escaping () async -> T) { }
1717
// ----------------------------------------------------------------------
1818
// Actor state isolation restrictions
1919
// ----------------------------------------------------------------------
20-
actor class MySuperActor {
20+
actor MySuperActor {
2121
var superState: Int = 25 // expected-note {{mutable state is only available within the actor instance}}
2222

2323
func superMethod() { } // expected-note 3 {{calls to instance method 'superMethod()' from outside of its actor context are implicitly asynchronous}}
@@ -28,7 +28,7 @@ actor class MySuperActor {
2828
}
2929
}
3030

31-
actor class MyActor: MySuperActor {
31+
actor MyActor: MySuperActor {
3232
let immutable: Int = 17
3333
var text: [String] = [] // expected-note 10{{mutable state is only available within the actor instance}}
3434

@@ -199,7 +199,7 @@ extension MyActor {
199199
// ----------------------------------------------------------------------
200200
// Global actor isolation restrictions
201201
// ----------------------------------------------------------------------
202-
actor class SomeActor { }
202+
actor SomeActor { }
203203

204204
@globalActor
205205
struct SomeGlobalActor {
@@ -395,7 +395,7 @@ func checkLocalFunctions() async {
395395
// Lazy properties with initializers referencing 'self'
396396
// ----------------------------------------------------------------------
397397

398-
actor class LazyActor {
398+
actor LazyActor {
399399
var v: Int = 0
400400
// expected-note@-1 6 {{mutable state is only available within the actor instance}}
401401

@@ -450,7 +450,7 @@ extension SomeClassInActor.ID {
450450
// ----------------------------------------------------------------------
451451
// Initializers
452452
// ----------------------------------------------------------------------
453-
actor class SomeActorWithInits {
453+
actor SomeActorWithInits {
454454
var mutableState: Int = 17
455455
var otherMutableState: Int
456456

test/Concurrency/actor_isolation_objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66

77
func g(_ selector: Selector) -> Int { }
88

9-
actor class A {
9+
actor A {
1010
func selectors() {
1111
_ = #selector(type(of: self).f) // expected-error{{argument of '#selector' refers to instance method 'f()' that is not exposed to Objective-C}}
1212
_ = #selector(type(of: self).g) // expected-error{{argument of '#selector' refers to instance method 'g()' that is not exposed to Objective-C}}

test/Concurrency/async_let_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22
// REQUIRES: concurrency
33

4-
actor class MyActor {
4+
actor MyActor {
55
let immutable: Int = 17
66
var text: [String] = []
77

test/Concurrency/closure_isolation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ func acceptEscapingClosure<T>(_: @escaping () -> T) { }
77
func acceptAsyncClosure<T>(_: () async -> T) { }
88
func acceptEscapingAsyncClosure<T>(_: @escaping () async -> T) { }
99

10-
actor class MyActor {
10+
actor MyActor {
1111
func method() async -> String { "" }
1212
}
1313

@@ -36,7 +36,7 @@ extension MyActor {
3636
}
3737
}
3838

39-
actor class SomeActor { }
39+
actor SomeActor { }
4040

4141
@globalActor
4242
struct SomeGlobalActor {

test/Concurrency/concurrent_value_checking.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ class NotConcurrent { }
77
// ConcurrentValue restriction on actor operations
88
// ----------------------------------------------------------------------
99

10-
actor class A1 {
10+
actor A1 {
1111
let localLet: NotConcurrent = NotConcurrent()
1212
func synchronous() -> NotConcurrent? { nil }
1313
func asynchronous(_: NotConcurrent?) async { }
1414
}
1515

16-
actor class A2 {
16+
actor A2 {
1717
var localVar: NotConcurrent
1818

1919
init(value: NotConcurrent) {
@@ -46,7 +46,7 @@ extension A1 {
4646
// ----------------------------------------------------------------------
4747
// ConcurrentValue restriction on global actor operations
4848
// ----------------------------------------------------------------------
49-
actor class TestActor {}
49+
actor TestActor {}
5050

5151
@globalActor
5252
struct SomeGlobalActor {

test/Concurrency/default_actor_definit.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// RUN: %target-swift-frontend -emit-sil %s -enable-experimental-concurrency | %FileCheck %s
22
// REQUIRES: concurrency
33

4-
actor class A {
4+
actor A {
55
var x: String = "Hello"
66
var y: String = "World"
77
}
88
// CHECK-LABEL: sil hidden @$s21default_actor_definit1ACACycfc
99
// CHECK: builtin "initializeDefaultActor"(%0 : $A) : $()
1010
// CHECK-LABEL: end sil function '$s21default_actor_definit1ACACycfc'
1111

12-
actor class B {
12+
actor B {
1313
var x: String
1414
var y: String
1515

@@ -22,7 +22,7 @@ actor class B {
2222
// CHECK: builtin "initializeDefaultActor"(%0 : $B) : $()
2323
// CHECK-LABEL: end sil function '$s21default_actor_definit1BCACycfc'
2424

25-
actor class C {
25+
actor C {
2626
var x: String
2727
var y: Int
2828

test/Concurrency/global_actor_from_ordinary_context.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// provides coverage for rdar://71548470
55

6-
actor class TestActor {}
6+
actor TestActor {}
77

88
@globalActor
99
struct SomeGlobalActor {
@@ -14,7 +14,7 @@ struct SomeGlobalActor {
1414
@SomeGlobalActor func syncGlobActorFn() { }
1515
@SomeGlobalActor func asyncGlobalActFn() async { }
1616

17-
actor class Alex {
17+
actor Alex {
1818
@SomeGlobalActor let const_memb = 20
1919
@SomeGlobalActor var mut_memb = 30 // expected-note 2 {{mutable state is only available within the actor instance}}
2020
@SomeGlobalActor func method() {} // expected-note 2 {{calls to instance method 'method()' from outside of its actor context are implicitly asynchronous}}

test/Concurrency/global_actor_inference.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22
// REQUIRES: concurrency
33

4-
actor class SomeActor { }
4+
actor SomeActor { }
55

66
@globalActor
77
struct SomeGlobalActor {
@@ -140,7 +140,7 @@ class C6: P2, P3 {
140140
// ----------------------------------------------------------------------
141141
// Global actor checking for overrides
142142
// ----------------------------------------------------------------------
143-
actor class GenericSuper<T> {
143+
actor GenericSuper<T> {
144144
@GenericGlobalActor<T> func method() { }
145145

146146
@GenericGlobalActor<T> func method2() { } // expected-note {{overridden declaration is here}}
@@ -149,7 +149,7 @@ actor class GenericSuper<T> {
149149
@GenericGlobalActor<T> func method5() { }
150150
}
151151

152-
actor class GenericSub<T> : GenericSuper<[T]> {
152+
actor GenericSub<T> : GenericSuper<[T]> {
153153
override func method() { } // expected-note{{calls to instance method 'method()' from outside of its actor context are implicitly asynchronous}}
154154

155155
@GenericGlobalActor<T> override func method2() { } // expected-error{{global actor 'GenericGlobalActor<T>'-isolated instance method 'method2()' has different actor isolation from global actor 'GenericGlobalActor<[T]>'-isolated overridden declaration}}

test/IRGen/actor_class.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// CHECK-SAME: i16 1, i16 12, i32 2, i32 6,
3838
// CHECK-SAME: @"symbolic BD"
3939

40-
public actor class MyClass {
40+
public actor MyClass {
4141
public var x: Int
4242
public init() { self.x = 0 }
4343
}
@@ -60,7 +60,7 @@ public actor class MyClass {
6060
// CHECK: swift_defaultActor_destroy
6161
// CHECK-LABEL: ret
6262

63-
public actor class Exchanger<T> {
63+
public actor Exchanger<T> {
6464
public var value: T
6565

6666
public init(value: T) { self.value = value }

test/IRGen/actor_class_forbid_objc_assoc_objects.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import _Concurrency
77

88
// CHECK: @_METACLASS_DATA__TtC37actor_class_forbid_objc_assoc_objects5Actor = internal constant { {{.*}} } { i32 [[METAFLAGS:1153]],
99
// CHECK: @_DATA__TtC37actor_class_forbid_objc_assoc_objects5Actor = internal constant { {{.*}} } { i32 [[OBJECTFLAGS:1152|1216]],
10-
final actor class Actor {
10+
final actor Actor {
1111
}
1212

1313
// CHECK: @_METACLASS_DATA__TtC37actor_class_forbid_objc_assoc_objects6Actor2 = internal constant { {{.*}} } { i32 [[METAFLAGS]],
1414
// CHECK: @_DATA__TtC37actor_class_forbid_objc_assoc_objects6Actor2 = internal constant { {{.*}} } { i32 [[OBJECTFLAGS]],
15-
actor class Actor2 {
15+
actor Actor2 {
1616
}
1717

1818
// CHECK: @_METACLASS_DATA__TtC37actor_class_forbid_objc_assoc_objects6Actor3 = internal constant { {{.*}} } { i32 [[METAFLAGS]],
1919
// CHECK: @_DATA__TtC37actor_class_forbid_objc_assoc_objects6Actor3 = internal constant { {{.*}} } { i32 [[OBJECTFLAGS]],
2020
class Actor3 : Actor2 {}
2121

22-
actor class GenericActor<T> {
22+
actor GenericActor<T> {
2323
var state: T
2424
init(state: T) { self.state = state }
2525
}

test/IRGen/actor_class_objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Foundation
3232
// CHECK-64-SAME: i64 96,
3333
// CHECK-32-SAME: i32 48,
3434

35-
public actor class MyClass: NSObject {
35+
public actor MyClass: NSObject {
3636
public var x: Int
3737
public override init() { self.x = 0 }
3838
}

test/IRGen/async/hop_to_executor.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Builtin
88
import Swift
99
import _Concurrency
1010

11-
final actor class MyActor {
11+
final actor MyActor {
1212
}
1313

1414
// CHECK-LABEL: define{{.*}} void @test_simple(%swift.task* %0, %swift.executor* %1, %swift.context* swiftasync %2)

test/IRGen/async/run-switch-executor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Currently this test just checks if nothing crashes.
1717
// TODO: also check if the current executor is the correct one.
1818

19-
final actor class MyActor {
19+
final actor MyActor {
2020
var p: Int
2121

2222
@inline(never)

test/IRGen/ptrauth-actor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import Swift
99
import _Concurrency
1010

11-
public actor class A1 {
11+
public actor A1 {
1212
var x: Int = 17
1313
}
1414

15-
open actor class A3<T>: Actor {
15+
open actor A3<T>: Actor {
1616
open func f() { }
1717
}
1818

0 commit comments

Comments
 (0)