Skip to content

Commit 6cd1fb2

Browse files
committed
[Distributed] Improve error messages on property isolation
1 parent c57cb45 commit 6cd1fb2

27 files changed

+77
-73
lines changed

include/swift/AST/DiagnosticsSema.def

+5-6
Original file line numberDiff line numberDiff line change
@@ -4762,18 +4762,17 @@ ERROR(distributed_actor_user_defined_special_property,none,
47624762
"distributed actor synthesized stored property",
47634763
(DeclName))
47644764
ERROR(distributed_property_can_only_be_computed_get_only,none,
4765-
"'distributed' computed property %0 can only be have a 'get' implementation",
4765+
"'distributed' computed property %0 cannot have setter",
47664766
(DeclName))
47674767
ERROR(distributed_property_cannot_be_static,none,
47684768
"'distributed' property %0 cannot be 'static'",
47694769
(DeclName))
47704770
ERROR(distributed_property_can_only_be_computed,none,
4771-
"static property %0 cannot be 'distributed', because it is not a computed "
4772-
"get-only property",
4773-
(DeclName))
4771+
"%0 %1 cannot be 'distributed', only computed properties can",
4772+
(DescriptiveDeclKind, DeclName))
47744773
NOTE(distributed_actor_isolated_property,none,
4775-
"access to this property is only permitted within the distributed actor %0",
4776-
(DeclName))
4774+
"access to %0 %1 is only permitted within distributed actor %2",
4775+
(DescriptiveDeclKind, DeclName, DeclName))
47774776

47784777
ERROR(concurrency_lib_missing,none,
47794778
"missing '%0' declaration, probably because the '_Concurrency' "

lib/Sema/TypeCheckConcurrency.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1960,9 +1960,10 @@ namespace {
19601960
// FIXME: Make this diagnostic more sensitive to the isolation context of
19611961
// the declaration.
19621962
if (isDistributedActor) {
1963-
if (dyn_cast<VarDecl>(decl)) {
1963+
if (isa<VarDecl>(decl)) {
19641964
// Distributed actor properties are never accessible externally.
19651965
decl->diagnose(diag::distributed_actor_isolated_property,
1966+
decl->getDescriptiveKind(), decl->getName(),
19661967
nominal->getName());
19671968
} else {
19681969
// it's a function or subscript

lib/Sema/TypeCheckDistributed.cpp

+30-34
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ bool swift::checkDistributedActorSystemAdHocProtocolRequirements(
215215
}
216216

217217
static bool checkDistributedTargetResultType(
218-
ModuleDecl *module,
219-
ValueDecl *valueDecl,
220-
llvm::SmallPtrSet<ProtocolDecl *, 2> serializationRequirements,
218+
ModuleDecl *module, ValueDecl *valueDecl,
219+
const llvm::SmallPtrSetImpl<ProtocolDecl *> &serializationRequirements,
221220
bool diagnose) {
222221
auto &C = valueDecl->getASTContext();
223222

@@ -227,7 +226,7 @@ static bool checkDistributedTargetResultType(
227226
} else if (auto var = dyn_cast<VarDecl>(valueDecl)) {
228227
resultType = var->getInterfaceType();
229228
} else {
230-
assert(false && "Unsupported distributed target");
229+
llvm_unreachable("Unsupported distributed target");
231230
}
232231

233232
if (resultType->isVoid())
@@ -241,7 +240,8 @@ static bool checkDistributedTargetResultType(
241240
};
242241

243242
auto isCodableRequirement =
244-
serializationRequirements == codableRequirements;
243+
checkDistributedSerializationRequirementIsExactlyCodable(
244+
C, serializationRequirements);
245245

246246
for(auto serializationReq : serializationRequirements) {
247247
auto conformance =
@@ -298,14 +298,9 @@ bool swift::checkDistributedFunction(FuncDecl *func, bool diagnose) {
298298
} // TODO(distributed): need to handle ProtocolDecl too?
299299

300300
// If the requirement is exactly `Codable` we diagnose it ia bit nicer.
301-
auto serializationRequirementIsCodable = false;
302-
if (serializationRequirements.size() == 2) {
303-
auto encodableType = C.getProtocol(KnownProtocolKind::Encodable);
304-
auto decodableType = C.getProtocol(KnownProtocolKind::Decodable);
305-
llvm::SmallPtrSet<ProtocolDecl *, 2> codableRequirements = {encodableType, decodableType};
306-
serializationRequirementIsCodable =
307-
serializationRequirements == codableRequirements;
308-
}
301+
auto serializationRequirementIsCodable =
302+
checkDistributedSerializationRequirementIsExactlyCodable(
303+
C, serializationRequirements);
309304

310305
// --- Check parameters for 'Codable' conformance
311306
for (auto param : *func->getParameters()) {
@@ -372,27 +367,18 @@ bool swift::checkDistributedActorProperty(VarDecl *var, bool diagnose) {
372367
return true;
373368
}
374369

375-
// only get-only computed properties are allowed to be distributed
376-
if (var->getReadImpl() == swift::ReadImplKind::Get) {
377-
if (var->getWriteImpl() != swift::WriteImplKind::Immutable) {
378-
var->diagnose(
379-
diag::distributed_property_can_only_be_computed_get_only,
380-
var->getName());
381-
return true;
382-
}
383-
} else {
384-
// it is not a computed property
385-
if (var->isLet()) {
386-
var->diagnose(
387-
diag::distributed_property_can_only_be_computed,
388-
var->getName());
389-
return true;
390-
} else {
391-
var->diagnose(
392-
diag::distributed_property_can_only_be_computed_get_only,
393-
var->getName());
394-
return true;
395-
}
370+
// it is not a computed property
371+
if (var->isLet() || var->hasStorageOrWrapsStorage()) {
372+
var->diagnose(diag::distributed_property_can_only_be_computed,
373+
var->getDescriptiveKind(), var->getName());
374+
return true;
375+
}
376+
377+
// distributed properties cannot have setters
378+
if (var->getWriteImpl() != swift::WriteImplKind::Immutable) {
379+
var->diagnose(diag::distributed_property_can_only_be_computed_get_only,
380+
var->getName());
381+
return true;
396382
}
397383

398384
// === Check the type of the property
@@ -561,6 +547,16 @@ swift::flattenDistributedSerializationTypeToRequiredProtocols(TypeBase *serializ
561547
return serializationReqs;
562548
}
563549

550+
bool swift::checkDistributedSerializationRequirementIsExactlyCodable(
551+
ASTContext &C,
552+
const llvm::SmallPtrSetImpl<ProtocolDecl *> &allRequirements) {
553+
auto encodable = C.getProtocol(KnownProtocolKind::Encodable);
554+
auto decodable = C.getProtocol(KnownProtocolKind::Decodable);
555+
556+
return allRequirements.size() == 2 && allRequirements.count(encodable) &&
557+
allRequirements.count(decodable);
558+
}
559+
564560
llvm::SmallPtrSet<ProtocolDecl *, 2>
565561
swift::extractDistributedSerializationRequirements(
566562
ASTContext &C,

lib/Sema/TypeCheckDistributed.h

+7
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ llvm::SmallPtrSet<ProtocolDecl *, 2>
8484
flattenDistributedSerializationTypeToRequiredProtocols(
8585
TypeBase *serializationRequirement);
8686

87+
/// Check if the `allRequirements` represent *exactly* the
88+
/// `Encodable & Decodable` (also known as `Codable`) requirement.
89+
/// If so, we can emit slightly nicer diagnostics.
90+
bool checkDistributedSerializationRequirementIsExactlyCodable(
91+
ASTContext &C,
92+
const llvm::SmallPtrSetImpl<ProtocolDecl *> &allRequirements);
93+
8794
/// Given any set of generic requirements, locate those which are about the
8895
/// `SerializationRequirement`. Those need to be applied in the parameter and
8996
/// return type checking of distributed targets.

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_echo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_empty.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_genericFunc.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_hello.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_take.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_takeThrowReturn.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_take_two.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_throw.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_init_local.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_isRemote.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Onone -Xfrontend -g -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Onone -Xfrontend -g -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_remoteCall.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeCodableForDistributedTests.swiftmodule -module-name FakeCodableForDistributedTests -disable-availability-checking %S/../Inputs/FakeCodableForDistributedTests.swift
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeCodableForDistributedTests.swift -o %t/a.out
4-
// RUN: %target-run %t/a.out | %FileCheck %s --color --dump-input=always
4+
// RUN: %target-run %t/a.out | %FileCheck %s --color
55

66
// REQUIRES: executable_test
77
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_remoteCall_roundtrip.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %target-build-swift -module-name main -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -j2 -parse-as-library -I %t %s %S/../Inputs/FakeDistributedActorSystems.swift -o %t/a.out
44
// RUN: %target-run %t/a.out | %FileCheck %s --enable-var-scope --color
55

6-
// X: %target-run-simple-swift( -Xfrontend -module-name=main -Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library -Xfrontend -I -Xfrontend %t ) | %FileCheck %s --dump-input=always
6+
// X: %target-run-simple-swift( -Xfrontend -module-name=main -Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library -Xfrontend -I -Xfrontend %t ) | %FileCheck %s
77

88
// REQUIRES: executable_test
99
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_remote_fieldsDontCrashDeinit.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Onone -Xfrontend -g -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Onone -Xfrontend -g -Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_remote_functions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_remote_retains_system.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_actor_whenLocal.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-distributed -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/Runtime/distributed_func_metadata.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s --dump-input=always
1+
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-distributed -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/Distributed/SIL/distributed_actor_remoteCall_sil.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
3-
// RUN: %target-swift-frontend -module-name remoteCall -primary-file %s -emit-sil -enable-experimental-distributed -disable-availability-checking -I %t | %FileCheck %s --enable-var-scope --color --dump-input=always
3+
// RUN: %target-swift-frontend -module-name remoteCall -primary-file %s -emit-sil -enable-experimental-distributed -disable-availability-checking -I %t | %FileCheck %s --enable-var-scope --color
44
// REQUIRES: concurrency
55
// REQUIRES: distributed
66

test/Distributed/distributed_actor_inference.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ distributed actor SomeDistributedActor_6 {
5959

6060
distributed actor BadValuesDistributedActor_7 {
6161
distributed var varItNope: Int { 13 } // we allow these
62-
distributed let letItNope: Int = 13 // expected-error{{static property 'letItNope' cannot be 'distributed', because it is not a computed get-only property}}
63-
distributed lazy var lazyVarNope: Int = 13 // expected-error{{'distributed' computed property 'lazyVarNope' can only be have a 'get' implementation}}
62+
distributed let letItNope: Int = 13 // expected-error{{property 'letItNope' cannot be 'distributed', only computed properties can}}
63+
distributed lazy var lazyVarNope: Int = 13 // expected-error{{property 'lazyVarNope' cannot be 'distributed', only computed properties can}}
6464
distributed subscript(nope: Int) -> Int { nope * 2 } // expected-error{{'distributed' modifier cannot be applied to this declaration}}
6565
distributed static let staticLetNope: Int = 13 // expected-error{{'distributed' property 'staticLetNope' cannot be 'static'}}
6666
distributed static var staticVarNope: Int { 13 } // expected-error{{'distributed' property 'staticVarNope' cannot be 'static'}}

test/Distributed/distributed_actor_isolation.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ struct NotCodableValue { }
2828

2929
distributed actor DistributedActor_1 {
3030

31-
let name: String = "alice" // expected-note{{access to this property is only permitted within the distributed actor 'DistributedActor_1'}}
32-
var mutable: String = "alice" // expected-note{{access to this property is only permitted within the distributed actor 'DistributedActor_1'}}
31+
let name: String = "alice" // expected-note{{access to property 'name' is only permitted within distributed actor 'DistributedActor_1'}}
32+
var mutable: String = "alice" // expected-note{{access to property 'mutable' is only permitted within distributed actor 'DistributedActor_1'}}
3333
var computedMutable: String {
3434
get {
3535
"hey"
@@ -39,8 +39,8 @@ distributed actor DistributedActor_1 {
3939
}
4040
}
4141

42-
distributed let letProperty: String = "" // expected-error{{static property 'letProperty' cannot be 'distributed', because it is not a computed get-only property}}
43-
distributed var varProperty: String = "" // expected-error{{'distributed' computed property 'varProperty' can only be have a 'get' implementation}}
42+
distributed let letProperty: String = "" // expected-error{{property 'letProperty' cannot be 'distributed', only computed properties can}}
43+
distributed var varProperty: String = "" // expected-error{{property 'varProperty' cannot be 'distributed', only computed properties can}}
4444

4545
distributed static func distributedStatic() {} // expected-error{{'distributed' method cannot be 'static'}}
4646
distributed class func distributedClass() {}

test/Distributed/distributed_actor_isolation_and_tasks.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ struct Logger {
1818

1919
distributed actor Philosopher {
2020
let log: Logger
21-
// expected-note@-1{{access to this property is only permitted within the distributed actor 'Philosopher'}}
21+
// expected-note@-1{{access to property 'log' is only permitted within distributed actor 'Philosopher'}}
22+
2223
var variable = 12
2324
var variable_fromDetach = 12
2425
let INITIALIZED: Int

0 commit comments

Comments
 (0)