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-12885] Compiler crash involving Self
-returning function
#55332
Comments
This doesn't crash for me on master. Could you try with a trunk and/or 5.3 snapshot? |
Yeah, I'm not getting a crash on the 5.3 snapshot from May 19, so that probably means it's fixed. |
Comment by Maxim Krouk (JIRA) (swift 5.2) Faced the same issue here import SwiftUI
internal final class DropHanlder: DropDelegate {
private var _performDrop: ((DropInfo) -> Bool)?
public func performDrop(info: DropInfo) -> Bool { _performDrop?(info) ?? false }
@discardableResult
public func onDrop(perform action: ((DropInfo) -> Bool)?) -> Self {
modification(of: self, \._performDrop, to: action)
}
}
public func modification<Object, Value>(
of object: Object,
_ keyPath: WritableKeyPath<Object, Value>,
to value: Value
) -> Object { modification(of: object) { $0[keyPath: keyPath] = value } }
public func modification<Object>(
of object: Object,
transform: (inout Object) throws -> Void
) rethrows -> Object {
var object = object
try transform(&object)
return object
} with @discardableResult func...-> Self Works fine with {code:swift} -> DropDelegate instead of
{code:swift} -> Self Or with {code:swift} _performDrop = action; return self instead of
{code:swift} modification(of: self, \._performDrop, to: action) Logs:
|
@theblixguy Since you and @bjhomer reported fixed on master, should this be resolved/closed? 🙂 |
Attachment: Download
Environment
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Xcode 11.5
Additional Detail from JIRA
md5: 35d40c51dca59b8ead4d845e9d05c296
Issue Description:
The following code crashes the compiler in Xcode 11.5, but did not crash using Xcode 11.4.1. The crash only happens when compiling in release mode:
The crash goes away if I use `CrashyThing` instead of `Self`
The text was updated successfully, but these errors were encountered: