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-14127] Assigning value of lazy property in observer cause infinite recursion #56508

Open
swift-ci opened this issue Jan 29, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14127
Radar rdar://problem/73770090
Original Reporter garlic (JIRA User)
Type Bug
Environment

Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)

Target: x86_64-apple-darwin19.6.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: f8ee656ccbd91c78b2e6c50d45d7e2b0

Issue Description:

struct a {
    lazy var atMostNine: Int = 7 {
        willSet {
            print("will set: \(newValue)")
        }
        didSet {
            atMostNine = min(9, atMostNine)
            print("did set: \(atMostNine)")
        }
    }
}
var some = a()
some.atMostNine = 11

Expected output:

willSet: 11
didSet: 9

Actual output:

will set: 11
will set: 9
...
will set: 9
...
...
will set: 9
...
...
...
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

2 participants