Skip to content

Commit 18a849e

Browse files
authored
Merge pull request #38708 from DougGregor/global-actor-isolated-inherits-nonisolated-5.5
2 parents 57b78f5 + 0acdfb2 commit 18a849e

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3028,14 +3028,7 @@ static bool checkClassGlobalActorIsolation(
30283028
switch (superIsolation) {
30293029
case ActorIsolation::Unspecified:
30303030
case ActorIsolation::Independent:
3031-
// Allow ObjC superclasses with unspecified global actors, because we do
3032-
// not expect for Objective-C classes to have been universally annotated.
3033-
// FIXME: We might choose to tighten this up in Swift 6.
3034-
if (superclassDecl->getClangNode())
3035-
return false;
3036-
3037-
// Break out to diagnose the error below.
3038-
break;
3031+
return false;
30393032

30403033
case ActorIsolation::ActorInstance:
30413034
// This is an error that will be diagnosed later. Ignore it here.

test/Concurrency/actor_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ actor Counter {
956956
class C2 { }
957957

958958
@SomeGlobalActor
959-
class C3: C2 { } // expected-error{{global actor 'SomeGlobalActor'-isolated class 'C3' has different actor isolation from nonisolated superclass 'C2'}}
959+
class C3: C2 { } // it's okay to add a global actor to a nonisolated class.
960960

961961
@GenericGlobalActor<U>
962962
class GenericSuper<U> { }

test/Concurrency/global_actor_inference.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class SuperclassWithGlobalActors {
219219
func j() { }
220220
}
221221

222-
@GenericGlobalActor<String> // expected-error@+1{{global actor 'GenericGlobalActor<String>'-isolated class 'SubclassWithGlobalActors' has different actor isolation from nonisolated superclass 'SuperclassWithGlobalActors'}}
222+
@GenericGlobalActor<String> // it's okay to add a global actor to nonisolated
223223
class SubclassWithGlobalActors : SuperclassWithGlobalActors {
224224
override func f() { } // okay: inferred to @GenericGlobalActor<Int>
225225

0 commit comments

Comments
 (0)