-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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-11198] Compiler crash on inout-to-pointer used with @autoclosure param returning optional #53595
Comments
I guess we shouldn't allow inout-to-pointer (or any other lifetime-based conversions) in autoclosure contexts. cc @xedin |
@swift-ci create Not allowing such conversions in @autoclosure make sense to me! |
/cc @hborla Might be a good StarterBug for expression type-checker |
Is anyone working on this already? If not, since is a starter bug I'd like to give it a shot |
@hborla has started working on this. Sorry we didn't update the assignee... |
Sure, thank's for the answer @xedin 👍 |
@LucianoPAlmeida I haven't started working on the crash part of this yet. I'm finishing up improving the diagnostic for the non-optional case, PR is up now https://github.com/apple/swift/pull/26470 Do you still want to give this a shot? |
@hborla Since PR allows conversion between type and pointer, it might solve the crash as well, because it should be able to attempt implicit conversion from `UnsafePointer<Int>` to `UnsafePointer<Int>`? |
Unfortunately the problem is that within |
We already do check wether left-hand side of the type is autoclosure result, so we just need to tweak that check a bit to account for presence of optional. Sorry I got confused about what we are trying to do here. |
Please verify and close. |
Environment
Swift version 5.1-dev (LLVM 200186e28b, Swift 12fa06a)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
md5: 6b471bed87673773b6da077848441e95
Issue Description:
The following hits an assertion in SILGen:
Really we probably shouldn't be letting this code past Sema, as we currently reject the non-optional form (albeit with a suboptimal diagnostic):
The text was updated successfully, but these errors were encountered: