Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
11760b1
[main] Add swift-foundation/swift-foundation-icu branch to release/6.…
jmschonfeld Jul 18, 2024
2c1e45a
Changed note main actor variables
rofle100lvl Jul 20, 2024
955c56c
[Macros] Remove SwiftOperators dependency
hamishknight Jul 20, 2024
dc13137
Merge pull request #75339 from jmschonfeld/swift-6-swift-foundation
shahmishal Jul 20, 2024
ee2dd82
Merge pull request #75235 from rofle100lvl/change_note_main_actor_var…
hborla Jul 20, 2024
900f1b5
Merge pull request #75384 from hamishknight/remove-operators-dep
hamishknight Jul 20, 2024
9a5c7d4
replace accessor to type name
iMostfa Jun 15, 2024
1192ffd
replace accessor in various diagnostics messages, delete unused one
iMostfa Jun 15, 2024
089a738
update final_not_on_accessors
iMostfa Jun 15, 2024
e450edf
change change_to_mutating to use setter/getter
iMostfa Jun 15, 2024
426e3dd
update objc_init_accessor
iMostfa Jun 15, 2024
d819c16
update tests
iMostfa Jun 15, 2024
9c041c6
reword some diagnostics
iMostfa Jul 1, 2024
13238d5
revert init accessors changes + update tests
iMostfa Jul 1, 2024
3aa768a
update acessor_macros tests
iMostfa Jul 2, 2024
1e83520
remove member from noncopyable_cannot_have_read_set_accessor
iMostfa Jul 2, 2024
f39ef8a
update effectful_property_wrapper
iMostfa Jul 2, 2024
c426560
Add apostrophes around @objc
iMostfa Jul 14, 2024
040fa15
Add property wrapper to a message
iMostfa Jul 14, 2024
4fb2f78
Revert the removal of an accessor word
iMostfa Jul 14, 2024
6a63a0d
reword final_not_on_accessors
iMostfa Jul 19, 2024
ad524c1
Fixed tests
iMostfa Jul 20, 2024
4ff3b9c
remove distributed_property_accessor_only_get_can_be_distributed
iMostfa Jul 24, 2024
4d2c617
Remove 'currently' from property_wrapper_effectful
iMostfa Aug 11, 2024
618051a
Add 'observers' to objc_observing_accessor
iMostfa Aug 11, 2024
d00dd6c
Remove let from final_not_on_accessors
iMostfa Aug 11, 2024
3cd17c7
Fix attr_objc
iMostfa Aug 14, 2024
3d65051
Fix effectful_property_wrapper.swift
iMostfa Aug 14, 2024
ccacc70
Formatting
iMostfa Aug 14, 2024
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
21 changes: 9 additions & 12 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -3952,8 +3952,8 @@ ERROR(attr_incompatible_with_objc,none,
(DeclAttribute, DescriptiveDeclKind))

ERROR(final_not_on_accessors,none,
"'final' cannot be applied to accessors, it must be put on the "
"%select{var|let|subscript}0", (unsigned))
"only the %select{property|subscript}0 itself can be marked as 'final'"
,(bool))

ERROR(override_rethrows_with_non_rethrows,none,
"override of 'rethrows' %select{method|initializer}0 should also "
Expand Down Expand Up @@ -4985,8 +4985,8 @@ NOTE(candidate_is_not_assignable,none,
(const ValueDecl *))

NOTE(change_to_mutating,none,
"mark %select{method|accessor}0 'mutating' to make 'self' mutable",
(bool))
"mark %select{method|%1}0 'mutating' to make 'self' mutable",
(bool, StringRef))
NOTE(masked_mutable_property,none,
"add explicit '%0' to refer to mutable %1 of %2",
(StringRef, DescriptiveDeclKind, Type))
Expand Down Expand Up @@ -5344,7 +5344,7 @@ NOTE(note_add_distributed_to_decl,none,
ERROR(invalid_isolated_calls_in_body,none,
"calls to '@%0'-isolated' code in %kind1",
(StringRef, const ValueDecl *))
NOTE(add_globalactor_to_function,none,
NOTE(add_globalactor_to_decl,none,
"add '@%0' to make %kind1 part of global actor %2",
(StringRef, const ValueDecl *, Type))
FIXIT(insert_globalactor_attr, "@%0 ", (Type))
Expand Down Expand Up @@ -5579,8 +5579,6 @@ ERROR(shared_immutable_state_decl,none,
NOTE(shared_state_make_immutable,none,
"convert %0 to a 'let' constant to make 'Sendable' shared state immutable",
(const ValueDecl *))
NOTE(shared_state_main_actor_node,none,
"annotate %0 with '@MainActor' if property should only be accessed from the main actor", (const ValueDecl *))
NOTE(shared_state_nonisolated_unsafe,none,
"disable concurrency-safety checks if accesses are protected by an external synchronization mechanism", (const ValueDecl *))
ERROR(actor_isolated_witness,none,
Expand Down Expand Up @@ -6314,9 +6312,8 @@ NOTE(objc_witness_objc_requirement,none,
ERROR(no_opaque_return_type_of,none,
"unable to resolve type for _opaqueReturnTypeOf attribute", ())


ERROR(objc_observing_accessor, none,
"observing accessors are not allowed to be marked @objc", ())
"observers (%0) are not allowed to be marked '@objc'", (DescriptiveDeclKind))
ERROR(objc_init_accessor, none,
"init accessors cannot be marked @objc", ())
ERROR(objc_addressor, none,
Expand Down Expand Up @@ -7133,8 +7130,8 @@ ERROR(property_wrapper_computed, none,
"property wrapper cannot be applied to a computed property",
())
ERROR(property_wrapper_effectful,none,
"property wrappers currently cannot define an 'async' or 'throws' accessor",
())
"property wrapper's 'wrappedValue' property cannot define an 'async' or 'throws' %0",
(DescriptiveDeclKind))

ERROR(property_with_wrapper_conflict_attribute,none,
"property %0 with a wrapper cannot also be "
Expand Down Expand Up @@ -7546,7 +7543,7 @@ ERROR(invalid_decl_in_macro_expansion,none,
"macro expansion cannot introduce %0",
(DescriptiveDeclKind))
ERROR(let_accessor_expansion,none,
"cannot expand accessors on variable declared with 'let'",
"cannot expand accessor macro on variable declared with 'let'",
())
ERROR(invalid_main_type_in_macro_expansion,none,
"macro expansion cannot introduce '@main' type",
Expand Down
3 changes: 2 additions & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8357,8 +8357,9 @@ void VarDecl::emitLetToVarNoteIfSimple(DeclContext *UseDC) const {
}

auto &d = getASTContext().Diags;
auto descriptiveKindName = Decl::getDescriptiveKindName(FD->getDescriptiveKind());
auto diags = d.diagnose(FD->getFuncLoc(), diag::change_to_mutating,
isa<AccessorDecl>(FD));
isa<AccessorDecl>(FD), descriptiveKindName);
if (auto nonmutatingAttr =
FD->getAttrs().getAttribute<NonMutatingAttr>()) {
diags.fixItReplace(nonmutatingAttr->getLocation(), "mutating");
Expand Down
1 change: 0 additions & 1 deletion lib/Macros/Sources/ObservationMacros/ObservableMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import SwiftSyntax
import SwiftSyntaxMacros
import SwiftDiagnostics
import SwiftOperators
import SwiftSyntaxBuilder

public struct ObservableMacro {
Expand Down
15 changes: 9 additions & 6 deletions lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,13 @@ void AttributeChecker::visitObjCAttr(ObjCAttr *attr) {
if (!checkObjCDeclContext(D))
error = diag::invalid_objc_decl_context;
else if (auto accessor = dyn_cast<AccessorDecl>(func))
if (!accessor->isGetterOrSetter())
error = diag::objc_observing_accessor;
if (!accessor->isGetterOrSetter()) {
auto declKind = accessor->getDescriptiveKind();
diagnoseAndRemoveAttr(attr, diag::objc_observing_accessor, declKind)
.limitBehavior(behavior);
reason.describe(D);
return;
}
} else if (isa<ConstructorDecl>(D) ||
isa<DestructorDecl>(D) ||
isa<SubscriptDecl>(D) ||
Expand Down Expand Up @@ -2535,10 +2540,8 @@ void AttributeChecker::visitFinalAttr(FinalAttr *attr) {

if (auto *accessor = dyn_cast<AccessorDecl>(D)) {
if (!attr->isImplicit()) {
unsigned Kind = 2;
if (auto *VD = dyn_cast<VarDecl>(accessor->getStorage()))
Kind = VD->isLet() ? 1 : 0;
diagnose(attr->getLocation(), diag::final_not_on_accessors, Kind)
diagnose(attr->getLocation(), diag::final_not_on_accessors,
isa<VarDecl>(accessor->getStorage()))
.fixItRemove(attr->getRange());
return;
}
Expand Down
16 changes: 10 additions & 6 deletions lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,7 @@ namespace {
if (fn->getOverriddenDecl())
return false;

fn->diagnose(diag::add_globalactor_to_function,
fn->diagnose(diag::add_globalactor_to_decl,
globalActor->getWithoutParens().getString(),
fn, globalActor)
.fixItInsert(fn->getAttributeInsertionLoc(false),
Expand Down Expand Up @@ -5436,7 +5436,7 @@ ActorIsolation ActorIsolationRequest::evaluate(

// Diagnose global state that is not either immutable plus Sendable or
// isolated to a global actor.
auto checkGlobalIsolation = [var = dyn_cast<VarDecl>(value)](
auto checkGlobalIsolation = [var = dyn_cast<VarDecl>(value), &ctx](
ActorIsolation isolation) {
// Diagnose only declarations in the same module.
//
Expand Down Expand Up @@ -5480,10 +5480,14 @@ ActorIsolation ActorIsolationRequest::evaluate(
}
}

diagVar->diagnose(diag::shared_state_main_actor_node,
diagVar)
.fixItInsert(diagVar->getAttributeInsertionLoc(false),
"@MainActor ");
auto mainActor = ctx.getMainActorType();
if (mainActor) {
diagVar->diagnose(diag::add_globalactor_to_decl,
mainActor->getWithoutParens().getString(),
diagVar, mainActor)
.fixItInsert(diagVar->getAttributeInsertionLoc(false),
diag::insert_globalactor_attr, mainActor);
}
diagVar->diagnose(diag::shared_state_nonisolated_unsafe,
diagVar)
.fixItInsert(diagVar->getAttributeInsertionLoc(true),
Expand Down
3 changes: 2 additions & 1 deletion lib/Sema/TypeCheckDeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ bool swift::isRepresentableInObjC(
// willSet/didSet implementations are never exposed to objc, they are
// always directly dispatched from the synthesized setter.
diagnoseAndRemoveAttr(accessor, Reason.getAttr(),
diag::objc_observing_accessor)
diag::objc_observing_accessor,
accessor->getDescriptiveKind())
.limitBehavior(behavior);
Reason.describe(accessor);
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckPropertyWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static VarDecl *findValueProperty(ASTContext &ctx, NominalTypeDecl *nominal,

// The property may not have any effects right now.
if (auto getter = var->getEffectfulGetAccessor()) {
getter->diagnose(diag::property_wrapper_effectful);
getter->diagnose(diag::property_wrapper_effectful, getter->getDescriptiveKind());
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/Inputs/sendable_cycle_other.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct Foo {
static let member = Bar() // expected-complete-warning {{static property 'member' is not concurrency-safe because non-'Sendable' type 'Bar' may have shared mutable state; this is an error in the Swift 6 language mode}}
// expected-complete-note@-1 {{annotate 'member' with '@MainActor' if property should only be accessed from the main actor}}
// expected-complete-note@-1 {{add '@MainActor' to make static property 'member' part of global actor 'MainActor'}}
// expected-complete-note@-2{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
}
2 changes: 1 addition & 1 deletion test/Concurrency/concurrency_warnings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GlobalCounter { // expected-note{{class 'GlobalCounter' does not conform t

let rs = GlobalCounter() // expected-warning {{let 'rs' is not concurrency-safe because non-'Sendable' type 'GlobalCounter' may have shared mutable state; this is an error in the Swift 6 language mode}}
// expected-note@-1 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-2 {{annotate 'rs' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-2 {{add '@MainActor' to make let 'rs' part of global actor 'MainActor'}}

import GlobalVariables

Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/concurrent_value_checking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ typealias BadGenericCF<T> = @Sendable () -> T?
typealias GoodGenericCF<T: Sendable> = @Sendable () -> T? // okay

var concurrentFuncVar: (@Sendable (NotConcurrent) -> Void)? = nil // expected-warning{{var 'concurrentFuncVar' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode}}
// expected-note@-1 {{annotate 'concurrentFuncVar' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-1 {{add '@MainActor' to make var 'concurrentFuncVar' part of global actor 'MainActor'}}
// expected-note@-2 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-3 {{convert 'concurrentFuncVar' to a 'let' constant to make 'Sendable' shared state immutable}}

Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/flow_isolation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ struct CardboardBox<T> {

@available(SwiftStdlib 5.1, *)
var globalVar: EscapeArtist? // expected-warning {{var 'globalVar' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode}}
// expected-note@-1 {{annotate 'globalVar' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-1 {{add '@MainActor' to make var 'globalVar' part of global actor 'MainActor'}}
// expected-note@-2 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-3 {{convert 'globalVar' to a 'let' constant to make 'Sendable' shared state immutable}}

Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/freestanding_top_level.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-swift-frontend -concurrency-model=task-to-thread -typecheck -verify -verify-additional-prefix complete- -strict-concurrency=complete %s

// expected-complete-warning@+4 {{var 'global' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in the Swift 6 language mode}}
// expected-complete-note@+3 {{annotate 'global' with '@MainActor' if property should only be accessed from the main actor}}{{1-1=@MainActor }}
// expected-complete-note@+3 {{add '@MainActor' to make var 'global' part of global actor 'MainActor'}}{{1-1=@MainActor }}
// expected-complete-note@+2 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}{{1-1=nonisolated(unsafe) }}
// expected-complete-note@+1 {{convert 'global' to a 'let' constant to make 'Sendable' shared state immutable}}{{1-4=let}}
var global = 10
Expand Down
10 changes: 5 additions & 5 deletions test/Concurrency/global_variables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ actor TestGlobalActor {
var mutableIsolatedGlobal = 1

var mutableNonisolatedGlobal = 1 // expected-error{{var 'mutableNonisolatedGlobal' is not concurrency-safe because it is nonisolated global shared mutable state}}
// expected-note@-1{{annotate 'mutableNonisolatedGlobal' with '@MainActor' if property should only be accessed from the main actor}}{{1-1=@MainActor }}
// expected-note@-1{{add '@MainActor' to make var 'mutableNonisolatedGlobal' part of global actor 'MainActor'}}{{1-1=@MainActor }}
// expected-note@-2{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}{{1-1=nonisolated(unsafe) }}
// expected-note@-3{{convert 'mutableNonisolatedGlobal' to a 'let' constant to make 'Sendable' shared state immutable}}{{1-4=let}}

Expand Down Expand Up @@ -48,25 +48,25 @@ actor TestActor {
struct TestStatics {
static let immutableExplicitSendable = TestSendable()
static let immutableNonsendable = TestNonsendable() // expected-error{{static property 'immutableNonsendable' is not concurrency-safe because non-'Sendable' type 'TestNonsendable' may have shared mutable state}}
// expected-note@-1 {{annotate 'immutableNonsendable' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-1 {{add '@MainActor' to make static property 'immutableNonsendable' part of global actor 'MainActor'}}
// expected-note@-2 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
static nonisolated(unsafe) let immutableNonisolatedUnsafe = TestNonsendable()
static nonisolated let immutableNonisolated = TestNonsendable() // expected-error{{static property 'immutableNonisolated' is not concurrency-safe because non-'Sendable' type 'TestNonsendable' may have shared mutable state}}
// expected-note@-1 {{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-error@-2 {{'nonisolated' can not be applied to variable with non-'Sendable' type 'TestNonsendable'}}
// expected-note@-3{{annotate 'immutableNonisolated' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-3{{add '@MainActor' to make static property 'immutableNonisolated' part of global actor 'MainActor'}}
static nonisolated(unsafe) let immutableNonisolatedUnsafeSendable = TestSendable()
// expected-warning@-1 {{'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'TestSendable', consider removing it}} {{10-30=}}
static let immutableInferredSendable = 0
static var mutable = 0 // expected-error{{static property 'mutable' is not concurrency-safe because it is nonisolated global shared mutable state}}
// expected-note@-1{{convert 'mutable' to a 'let' constant to make 'Sendable' shared state immutable}}
// expected-note@-2{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-3{{annotate 'mutable' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-3{{add '@MainActor' to make static property 'mutable' part of global actor 'MainActor'}}
static var computedProperty: Int { 0 } // computed property that, though static, has no storage so is not a global
@TestWrapper static var wrapped: Int // expected-error{{static property 'wrapped' is not concurrency-safe because it is nonisolated global shared mutable state}}
// expected-note@-1{{convert 'wrapped' to a 'let' constant to make 'Sendable' shared state immutable}}{{23-26=let}}
// expected-note@-2{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}{{16-16=nonisolated(unsafe) }}
// expected-note@-3{{annotate 'wrapped' with '@MainActor' if property should only be accessed from the main actor}}{{3-3=@MainActor }}
// expected-note@-3{{add '@MainActor' to make static property 'wrapped' part of global actor 'MainActor'}}{{3-3=@MainActor }}
}

public actor TestPublicActor {
Expand Down
4 changes: 2 additions & 2 deletions test/Concurrency/predates_concurrency_import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let nonStrictGlobal = NonStrictClass() // no warning

let strictGlobal = StrictStruct() // expected-warning{{let 'strictGlobal' is not concurrency-safe because non-'Sendable' type 'StrictStruct' may have shared mutable state}}
// expected-note@-1{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-2{{annotate 'strictGlobal' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-2{{add '@MainActor' to make let 'strictGlobal' part of global actor 'MainActor'}}

extension NonStrictClass {
@Sendable func f() { }
Expand All @@ -62,7 +62,7 @@ struct HasStatics {
// expected-warning@-1{{'nonisolated' can not be applied to variable with non-'Sendable' type 'StrictStruct'}}
// expected-warning@-2{{static property 'ss' is not concurrency-safe because non-'Sendable' type 'StrictStruct' may have shared mutable state}}
// expected-note@-3{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}
// expected-note@-4{{annotate 'ss' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-4{{add '@MainActor' to make static property 'ss' part of global actor 'MainActor'}}
}

extension NonStrictClass2: @retroactive MySendableProto { }
Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/predates_concurrency_import_swift6.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func test(ss: StrictStruct, ns: NonStrictClass) {

let nonStrictGlobal = NonStrictClass()
let strictGlobal = StrictStruct() // expected-warning{{let 'strictGlobal' is not concurrency-safe because non-'Sendable' type 'StrictStruct' may have shared mutable state}}
// expected-note@-1{{annotate 'strictGlobal' with '@MainActor' if property should only be accessed from the main actor}}
// expected-note@-1{{add '@MainActor' to make let 'strictGlobal' part of global actor 'MainActor'}}
// expected-note@-2{{disable concurrency-safety checks if accesses are protected by an external synchronization mechanism}}

extension NonStrictClass {
Expand Down
2 changes: 1 addition & 1 deletion test/Macros/accessor_macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ macro addGetterMacro() =
#if TEST_DIAGNOSTICS
struct S {
@addGetterMacro let x: Int
// expected-warning@-1 {{cannot expand accessors on variable declared with 'let'; this is an error in the Swift 6 language mode}}
// expected-warning@-1 {{cannot expand accessor macro on variable declared with 'let'; this is an error in the Swift 6 language mode}}
}
#endif
8 changes: 4 additions & 4 deletions test/Sema/immutability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct SomeStruct {

var p: Int {
// Getters default to non-mutating.
get { // expected-note {{mark accessor 'mutating' to make 'self' mutable}} {{5-5=mutating }}
get { // expected-note {{mark getter 'mutating' to make 'self' mutable}} {{5-5=mutating }}
iv = 37 // expected-error {{cannot assign to property: 'self' is immutable}}
return 42
}
Expand All @@ -168,13 +168,13 @@ struct SomeStruct {
return 42
}
nonmutating
set { // expected-note {{mark accessor 'mutating' to make 'self' mutable}} {{-1:5-16=mutating}}
set { // expected-note {{mark setter 'mutating' to make 'self' mutable}} {{-1:5-16=mutating}}
iv = newValue // expected-error {{cannot assign to property: 'self' is immutable}}
}
}

var r : Int {
get { // expected-note {{mark accessor 'mutating' to make 'self' mutable}} {{5-5=mutating }}
get { // expected-note {{mark getter 'mutating' to make 'self' mutable}} {{5-5=mutating }}
iv = 37 // expected-error {{cannot assign to property: 'self' is immutable}}
return 42
}
Expand Down Expand Up @@ -708,7 +708,7 @@ extension JustAProtocol {
var foo: String {
get { return name }
nonmutating set { name = newValue } // expected-error {{cannot assign to property: 'self' is immutable}}
// expected-note@-1 {{mark accessor 'mutating' to make 'self' mutable}}{{5-16=mutating}}
// expected-note@-1 {{mark setter 'mutating' to make 'self' mutable}}{{5-16=mutating}}
}

nonmutating func bar() { // expected-note {{mark method 'mutating' to make 'self' mutable}}{{3-14=mutating}}
Expand Down
Loading