You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Xcode Version 9.3 beta 4 (9Q127n)
macOS 10.13.3 (17D102)
Model Name: MacBook Pro
Model Identifier: MacBookPro11,5
Additional Detail from JIRA
Votes
9
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: c9837c3c331cb29ff8595b6ce1439c11
is duplicated by:
SR-7335 Mutating struct when accessing read only member through subscript
Issue Description:
Summary:
In Xcode 9.3 Beta 4, the following code emits the string "Bug! didSet {} called on read" to the console. No property read should trigger the didSet call.
Steps to Reproduce:
Paste this Swift code into the swift command-line REPL:
protocol ProtocolWithArray {
var arrayOfInt: [Int] { get set }
}
var questionSet: ProtocolWithArray? {
didSet {
print("Bug! didSet {} called on read.")
}
}
Attachment: Download
Environment
Xcode Version 9.3 beta 4 (9Q127n)
macOS 10.13.3 (17D102)
Model Name: MacBook Pro
Model Identifier: MacBookPro11,5
Additional Detail from JIRA
md5: c9837c3c331cb29ff8595b6ce1439c11
is duplicated by:
Issue Description:
Summary:
In Xcode 9.3 Beta 4, the following code emits the string "Bug! didSet {} called on read" to the console. No property read should trigger the didSet call.
Steps to Reproduce:
Paste this Swift code into the swift command-line REPL:
protocol ProtocolWithArray {
var arrayOfInt: [Int] { get set }
}
var questionSet: ProtocolWithArray? {
didSet {
print("Bug! didSet {} called on read.")
}
}
func fiddle() -> Int? {
return questionSet?.arrayOfInt[0]
}
print("Starting")
fiddle()
print("Done")
Expected Results (as seen with Xcode 9.2):
Welcome to Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
...
Starting
Done
Actual Results (as seen with Xcode 9.3 Beta 4):
Welcome to Apple Swift version 4.1 (swiftlang-902.0.43 clang-902.0.37.1).
...
Starting
Bug! didSet {} called on read.
Done
The text was updated successfully, but these errors were encountered: