Skip to content

Commit edd4f2c

Browse files
committed
Don't implicitly add dynamic to stored properties
This can introduce an exclusivity check failure.
1 parent 6720cfc commit edd4f2c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,6 +2464,10 @@ void TypeChecker::addImplicitDynamicAttribute(Decl *D) {
24642464
return;
24652465

24662466
if (auto *VD = dyn_cast<VarDecl>(D)) {
2467+
// Don't turn stored into computed properties. This could conflict with
2468+
// exclusivity checking.
2469+
if (VD->hasStorage())
2470+
return;
24672471
// Don't add dynamic to local variables.
24682472
if (VD->getDeclContext()->isLocalContext())
24692473
return;

test/Interpreter/Inputs/dynamic_replacement_module.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public enum PublicEnumeration<Q> {
6666
}
6767
}
6868
#elseif MODULENODYNAMIC
69-
public var public_global_var = "public_global_var"
69+
public dynamic var public_global_var = "public_global_var"
7070

7171
public func public_global_func() -> String {
7272
return "public_global_func"

0 commit comments

Comments
 (0)