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 {

0 commit comments

Comments
 (0)