Environment
Swift 3 in Xcode 8.0 beta 3
Additional Detail from JIRA
| | |
|------------------|-----------------|
|Votes | 1 |
|Component/s | Compiler |
|Labels | Bug |
|Assignee | None |
|Priority | Medium |
md5: 476b00a40bdc9c4916c77c52def63f0a
Issue Description:
It is either a language bug or documentation bug.
Relevant doc from The Swift Programming Language:
“If you assign a value to a property within its own didSet observer, the new value that you assign replaces the one that was just set.”
“In the first of these two checks, the didSet observer sets currentLevel to a different value. This does not, however, cause the observer to be called again.”
class Foo {
init() {
i = 0
}
var i: Int {
didSet {
print("i = \(i)")
}
}
}
class Bar: Foo {
override var i: Int {
didSet {
i = i + 1
}
}
}
let bar = Bar()
bar.i = 1
Environment
Swift 3 in Xcode 8.0 beta 3Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 476b00a40bdc9c4916c77c52def63f0aIssue Description:
It is either a language bug or documentation bug.
Relevant doc from The Swift Programming Language: