Skip to content

Sema: Downgrade nonisolated lazy error to warning until -swift-version 6 #77690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7265,7 +7265,7 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {

if (var->getAttrs().hasAttribute<LazyAttr>()) {
diagnoseAndRemoveAttr(attr, diag::nonisolated_lazy)
.warnUntilSwiftVersionIf(attr->isImplicit(), 6);
.warnUntilSwiftVersion(6);
return;
}

Expand Down
20 changes: 10 additions & 10 deletions test/Concurrency/actor_isolation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -834,29 +834,29 @@ actor LazyActor {
lazy var l25: Int = { [unowned self] in self.l }()

nonisolated lazy var l31: Int = { v }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
// expected-warning@-2 {{actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode}}
nonisolated lazy var l32: Int = v
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l33: Int = { self.v }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
// expected-warning@-2 {{actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode}}
nonisolated lazy var l34: Int = self.v
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l35: Int = { [unowned self] in self.v }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
// expected-warning@-2 {{actor-isolated default value in a nonisolated context; this is an error in the Swift 6 language mode}}

nonisolated lazy var l41: Int = { l }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l42: Int = l
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l43: Int = { self.l }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l44: Int = self.l
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
nonisolated lazy var l45: Int = { [unowned self] in self.l }()
// expected-error@-1 {{'nonisolated' is not supported on lazy properties}}
// expected-warning@-1 {{'nonisolated' is not supported on lazy properties; this is an error in the Swift 6 language mode}}
}

// Infer global actors from context only for instance members.
Expand Down