Skip to content

[SR-419] Property observers not triggered on other instances of same class #43036

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

Closed
swift-ci opened this issue Dec 30, 2015 · 4 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-419
Radar rdar://problem/32334826
Original Reporter andyvn22 (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug
Assignee @hamishknight
Priority Medium

md5: 95314f70fefe4dcd9b362a8cdb300328

Issue Description:

Property observers are not triggered from observers on other instances of the same class:

class Thing {
    var related: Thing?
    var observerCalled = false
    var property: String = "Initial" {
        didSet {
            observerCalled = true
            related?.property = property //should trigger related's observer
        }
    }
}

let thing = Thing()
thing.related = Thing()
thing.property = "New Value"
print("thing observer called: \(thing.observerCalled) [expected true]") //true
print("related observer called: \(thing.related!.observerCalled) [expected true]") //false
@belkadan
Copy link
Contributor

belkadan commented Jan 4, 2016

Ugh. We really need to check that the base of the property access is statically self.

@hamishknight
Copy link
Contributor

#15280

@hamishknight
Copy link
Contributor

Resolved in the above linked PR, and will take effect in Swift 5 mode.

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 30, 2018

andyvn22 (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?
Thanks!
Anna

@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 itself
Projects
None yet
Development

No branches or pull requests

3 participants