Skip to content

Commit 3dc65c6

Browse files
committed
Update new test diagnostics
1 parent 6c1a2e2 commit 3dc65c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/Concurrency/async_initializer.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,19 @@ enum E {
103103
}
104104

105105
struct SomeStruct {
106-
@MainActor init(asyncMainActor: Int) async {}
106+
@MainActor init(asyncMainActor: Int) async {} // expected-note{{calls to initializer 'init(asyncMainActor:)' from outside of its actor context are implicitly asynchronous}}
107107
@MainActor init(mainActor: Int) {} // expected-note {{calls to initializer 'init(mainActor:)' from outside of its actor context are implicitly asynchronous}}
108108
@MainActor(unsafe) init(asyncMainActorUnsafe: Int) async {}
109109
@MainActor(unsafe) init(mainActorUnsafe: Int) {}
110110
}
111111

112-
// expected-note@+2 {{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
112+
// expected-note@+2 2{{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
113113
// expected-note@+1 2 {{add 'async' to function 'globActorTest1()' to make it asynchronous}}
114114
func globActorTest1() {
115115
_ = SomeStruct(asyncMainActor: 0) // expected-error {{'async' call in a function that does not support concurrency}}
116+
// expected-error@-1{{call to main actor-isolated initializer 'init(asyncMainActor:)' in a synchronous nonisolated context}}
116117

117-
_ = SomeStruct(mainActor: 0) // expected-error {{initializer 'init(mainActor:)' isolated to global actor 'MainActor' can not be referenced from this synchronous context}}
118+
_ = SomeStruct(mainActor: 0) // expected-error {{call to main actor-isolated initializer 'init(mainActor:)' in a synchronous nonisolated context}}
118119

119120
_ = SomeStruct(asyncMainActorUnsafe: 0) // expected-error {{'async' call in a function that does not support concurrency}}
120121

@@ -162,4 +163,4 @@ protocol Spicy: Plain {
162163
// expected-error@+2 {{cannot override non-async initializer with async initializer}}
163164
// expected-error@+1 {{initializer does not override a designated initializer from its parent protocol}}
164165
override init() async
165-
}
166+
}

0 commit comments

Comments
 (0)