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-8349] CustomStringConvertible and rethrows in Playgrounds #66
Comments
Reduced version:
|
Comment by Tony Y. (JIRA) The following code is appropriate, and will not crash. struct WillNotCrash: CustomStringConvertible {
var description: String {
let _ = self
return "some string"
}
}
WillNotCrash() @huonw Is the same the bug which causes BuggyStruct and WillCrash to crash? |
What do you mean by "appropriate"? Even if some code doesn't "make sense" for a real-world application, it can still be an example of the bug, and our suspicious is that those two are the same bug. |
Comment by Tony Y. (JIRA) I can understand that `self` in WillCrash calls the computed variable `description`. However, why does the 'rethrows' function call the computed variable `description`? |
Comment by Tony Y. (JIRA) I got no error when inserting "let _ = " at "self.bug(...)" as "WillNotCrash". |
Comment by Tony Y. (JIRA) Another code that will not crash: |
Comment by Connor Wakamo (JIRA) I've created a pull request which prevents PlaygroundLogger from logging recursively: <https://github.com/apple/swift-xcode-playground-support/pull/29\> |
Comment by Connor Wakamo (JIRA) Merged <https://github.com/apple/swift-xcode-playground-support/pull/29\> into apple/swift-xcode-playground-support master with a change which addresses this issue. |
Comment by Tony Y. (JIRA) I confirmed that the Xcode 10.1 beta 2 doesn't have this issue. |
Attachment: Download
Environment
macOS High Sierra
Xcode 9.4.1 (9F2000), Xcode 10 beta 1 to 6, Xcode 10 GM seed, and Xcode 10.0 (10A255)
Additional Detail from JIRA
md5: f44e7e48b8a3f02ecbd930690a6ba11c
Issue Description:
The following code crashes Xcode when run in Playground:
I got error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=2, address=0x7ffeeeb54ff8). The computed variable description was used many times (more than 1000 times as shown in the side bar of Playgrounds). When using throws instead of rethrows and adding try! at the throwing function self.bug(...), I got no error.
Swift Forums threads
The text was updated successfully, but these errors were encountered: