Skip to content
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

[SR-7695] WritableKeyPath mutation with multiple didSets does not propagate change #50235

Closed
swift-ci opened this issue May 16, 2018 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself key paths Feature: key paths (both native and Objective-C)

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7695
Radar rdar://problem/40295854
Original Reporter Vermeulen (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 9.3 with the Xcode 9.3 toolchain

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, KeyPaths, Miscompile
Assignee Vermeulen (JIRA)
Priority Medium

md5: a6422be6cfe3c9ccc7baa199c3760561

is duplicated by:

  • SR-7709 didSet values are incorrect when using KeyPaths

Issue Description:

struct Foo {
    var value: Int { didSet {} }
}

struct Bar {
    var foo: Foo { didSet {} }
}

var bar = Bar(foo: Foo(value: 1))

bar.foo[keyPath: \Foo.value] = 2
print(bar.foo.value) // prints 1

Removing either of the didSet blocks causes 2 to be printed instead.

@belkadan
Copy link
Contributor

Yikes! Thanks, Tim.

@swift-ci create

@jckarter
Copy link
Member

Fix for master: #18357

@jckarter
Copy link
Member

Merged! Should be fixed in future master branch snapshots.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself key paths Feature: key paths (both native and Objective-C)
Projects
None yet
Development

No branches or pull requests

3 participants