Skip to content

Commit 6fa2f76

Browse files
committed
[Exclusivity] Relax enforcement for separate struct stored properties
Relax the static enforcement of exclusive access so that we no longer diagnose on accesses to separate stored structs of the same property: takesInout(&s.f1, &s.f2) // no-warning And perform the analogous relaxation for tuple elements. To do this, track for each begin_access the projection path from that access and record the read and write-like modifications on a per-subpath basis. We still warn if the there are conflicting accesses on subpaths where one is the prefix of another. This commit leaves the diagnostic text in a not-so-good shape since we refer to the DescriptiveDeclKind of the access even describing a subpath. I'll fix that up in a later commit that changes only diagnostic text. https://bugs.swift.org/browse/SR-5119 rdar://problem/31909639
1 parent 6fc6251 commit 6fa2f76

File tree

5 files changed

+473
-86
lines changed

5 files changed

+473
-86
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ WARNING(exclusivity_access_required_swift3,none,
9393
"simultaneous accesses to %0 %1, but "
9494
"%select{initialization|read|modification|deinitialization}2 requires "
9595
"exclusive access; consider copying to a local variable",
96-
(DescriptiveDeclKind, Identifier, unsigned))
96+
(DescriptiveDeclKind, StringRef, unsigned))
9797

9898
ERROR(exclusivity_access_required,none,
9999
"simultaneous accesses to %0 %1, but "
100100
"%select{initialization|read|modification|deinitialization}2 requires "
101101
"exclusive access; consider copying to a local variable",
102-
(DescriptiveDeclKind, Identifier, unsigned))
102+
(DescriptiveDeclKind, StringRef, unsigned))
103103

104104
ERROR(exclusivity_access_required_unknown_decl,none,
105105
"simultaneous accesses, but "

0 commit comments

Comments
 (0)