Skip to content

Commit d8a12e9

Browse files
authored
Merge pull request #82925 from xedin/remove-concurrency-attr-clash-downgrade
[Concurrency] Don't downgrade explicit isolation attribute clashes
2 parents 0205969 + a9373c0 commit d8a12e9

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4397,7 +4397,6 @@ static void checkGlobalActorAttr(
43974397
attributes[1])
43984398
.highlight(attributes[0]->getRangeWithAt())
43994399
.highlight(attributes[1]->getRangeWithAt())
4400-
.warnUntilSwiftVersion(6)
44014400
.fixItRemove(attributes[1]->getRangeWithAt());
44024401
return;
44034402
}
@@ -4408,7 +4407,6 @@ static void checkGlobalActorAttr(
44084407
.highlight(attributes[0]->getRangeWithAt())
44094408
.highlight(attributes[1]->getRangeWithAt())
44104409
.highlight(attributes[2]->getRangeWithAt())
4411-
.warnUntilSwiftVersion(6)
44124410
.fixItRemove(attributes[1]->getRangeWithAt())
44134411
.fixItRemove(attributes[2]->getRangeWithAt());
44144412
return;
@@ -4421,7 +4419,6 @@ static void checkGlobalActorAttr(
44214419
.highlight(attributes[1]->getRangeWithAt())
44224420
.highlight(attributes[2]->getRangeWithAt())
44234421
.highlight(attributes[3]->getRangeWithAt())
4424-
.warnUntilSwiftVersion(6)
44254422
.fixItRemove(attributes[1]->getRangeWithAt())
44264423
.fixItRemove(attributes[2]->getRangeWithAt())
44274424
.fixItRemove(attributes[3]->getRangeWithAt());

test/Concurrency/isolated_parameters.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,15 @@ func isolatedClosures() {
339339
}
340340
}
341341

342-
// expected-warning@+3 {{global function 'allOfEm' has multiple actor-isolation attributes (@MainActor and 'nonisolated')}}
343-
// expected-warning@+2 {{global function with 'isolated' parameter cannot be 'nonisolated'; this is an error in the Swift 6 language mode}}{{12-24=}}
344-
// expected-warning@+1 {{global function with 'isolated' parameter cannot have a global actor; this is an error in the Swift 6 language mode}}{{1-12=}}
342+
#if ALLOW_TYPECHECKER_ERRORS
343+
344+
// expected-typechecker-error@+3 {{global function 'allOfEm' has multiple actor-isolation attributes (@MainActor and 'nonisolated')}}
345+
// expected-typechecker-warning@+2 {{global function with 'isolated' parameter cannot be 'nonisolated'; this is an error in the Swift 6 language mode}}{{12-24=}}
346+
// expected-typechecker-warning@+1 {{global function with 'isolated' parameter cannot have a global actor; this is an error in the Swift 6 language mode}}{{1-12=}}
345347
@MainActor nonisolated func allOfEm(_ a: isolated A) {
346348
a.f()
347349
}
348350

349-
#if ALLOW_TYPECHECKER_ERRORS
350-
351351
@MainActor class MAClass {
352352

353353
// expected-typechecker-note@+2 {{previous 'isolated' parameter 'a'}}

test/attr/execution_behavior_attrs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ struct TestAttributeCollisions {
9999
}
100100

101101
@MainActor @concurrent func testGlobalActor() async {}
102-
// expected-warning @-1 {{instance method 'testGlobalActor()' has multiple actor-isolation attributes (@MainActor and @concurrent)}}
102+
// expected-error@-1 {{instance method 'testGlobalActor()' has multiple actor-isolation attributes (@MainActor and @concurrent)}}
103103

104104
nonisolated(nonsending) nonisolated func testNonIsolatedCaller() async {} // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
105105
@MainActor nonisolated(nonsending) func testGlobalActorCaller() async {}
106-
// expected-warning@-1 {{instance method 'testGlobalActorCaller()' has multiple actor-isolation attributes (@MainActor and 'nonisolated(nonsending)')}}
106+
// expected-error@-1 {{instance method 'testGlobalActorCaller()' has multiple actor-isolation attributes (@MainActor and 'nonisolated(nonsending)')}}
107107
nonisolated(nonsending) func testCaller(arg: isolated MainActor) async {}
108108
// expected-error@-1 {{cannot use 'nonisolated(nonsending)' on instance method 'testCaller(arg:)' because it has an isolated parameter: 'arg'}}
109109

test/attr/global_actor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct Container {
9898
// Redundant attributes
9999
// -----------------------------------------------------------------------
100100
extension SomeActor {
101-
@GA1 nonisolated func conflict1() { } // expected-warning {{instance method 'conflict1()' has multiple actor-isolation attributes (@GA1 and 'nonisolated')}}
101+
@GA1 nonisolated func conflict1() { } // expected-error {{instance method 'conflict1()' has multiple actor-isolation attributes (@GA1 and 'nonisolated')}}
102102
}
103103

104104

0 commit comments

Comments
 (0)