Merge pull request #82925 from xedin/remove-concurrency-attr-clash-downgrade

[Concurrency] Don't downgrade explicit isolation attribute clashes
This commit is contained in:
Pavel Yaskevich
2025-07-11 10:52:06 -07:00
committed by GitHub
4 changed files with 8 additions and 11 deletions

View File

@@ -4397,7 +4397,6 @@ static void checkGlobalActorAttr(
attributes[1])
.highlight(attributes[0]->getRangeWithAt())
.highlight(attributes[1]->getRangeWithAt())
.warnUntilSwiftVersion(6)
.fixItRemove(attributes[1]->getRangeWithAt());
return;
}
@@ -4408,7 +4407,6 @@ static void checkGlobalActorAttr(
.highlight(attributes[0]->getRangeWithAt())
.highlight(attributes[1]->getRangeWithAt())
.highlight(attributes[2]->getRangeWithAt())
.warnUntilSwiftVersion(6)
.fixItRemove(attributes[1]->getRangeWithAt())
.fixItRemove(attributes[2]->getRangeWithAt());
return;
@@ -4421,7 +4419,6 @@ static void checkGlobalActorAttr(
.highlight(attributes[1]->getRangeWithAt())
.highlight(attributes[2]->getRangeWithAt())
.highlight(attributes[3]->getRangeWithAt())
.warnUntilSwiftVersion(6)
.fixItRemove(attributes[1]->getRangeWithAt())
.fixItRemove(attributes[2]->getRangeWithAt())
.fixItRemove(attributes[3]->getRangeWithAt());

View File

@@ -339,15 +339,15 @@ func isolatedClosures() {
}
}
// expected-warning@+3 {{global function 'allOfEm' has multiple actor-isolation attributes (@MainActor and 'nonisolated')}}
// expected-warning@+2 {{global function with 'isolated' parameter cannot be 'nonisolated'; this is an error in the Swift 6 language mode}}{{12-24=}}
// 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=}}
#if ALLOW_TYPECHECKER_ERRORS
// expected-typechecker-error@+3 {{global function 'allOfEm' has multiple actor-isolation attributes (@MainActor and 'nonisolated')}}
// expected-typechecker-warning@+2 {{global function with 'isolated' parameter cannot be 'nonisolated'; this is an error in the Swift 6 language mode}}{{12-24=}}
// 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=}}
@MainActor nonisolated func allOfEm(_ a: isolated A) {
a.f()
}
#if ALLOW_TYPECHECKER_ERRORS
@MainActor class MAClass {
// expected-typechecker-note@+2 {{previous 'isolated' parameter 'a'}}

View File

@@ -99,11 +99,11 @@ struct TestAttributeCollisions {
}
@MainActor @concurrent func testGlobalActor() async {}
// expected-warning @-1 {{instance method 'testGlobalActor()' has multiple actor-isolation attributes (@MainActor and @concurrent)}}
// expected-error@-1 {{instance method 'testGlobalActor()' has multiple actor-isolation attributes (@MainActor and @concurrent)}}
nonisolated(nonsending) nonisolated func testNonIsolatedCaller() async {} // expected-error {{duplicate modifier}} expected-note {{modifier already specified here}}
@MainActor nonisolated(nonsending) func testGlobalActorCaller() async {}
// expected-warning@-1 {{instance method 'testGlobalActorCaller()' has multiple actor-isolation attributes (@MainActor and 'nonisolated(nonsending)')}}
// expected-error@-1 {{instance method 'testGlobalActorCaller()' has multiple actor-isolation attributes (@MainActor and 'nonisolated(nonsending)')}}
nonisolated(nonsending) func testCaller(arg: isolated MainActor) async {}
// expected-error@-1 {{cannot use 'nonisolated(nonsending)' on instance method 'testCaller(arg:)' because it has an isolated parameter: 'arg'}}

View File

@@ -98,7 +98,7 @@ struct Container {
// Redundant attributes
// -----------------------------------------------------------------------
extension SomeActor {
@GA1 nonisolated func conflict1() { } // expected-warning {{instance method 'conflict1()' has multiple actor-isolation attributes (@GA1 and 'nonisolated')}}
@GA1 nonisolated func conflict1() { } // expected-error {{instance method 'conflict1()' has multiple actor-isolation attributes (@GA1 and 'nonisolated')}}
}