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-7883] Compiler segfault while trying to use optional method of objc protocol #50418
Comments
@swift-ci create |
Looks like this only happens when methods are imported, since this swift code is going to produce a correct error about missing '?':
|
/cc @rudkx Looks like this is related to new IOUs, in the code like in my previous comment optional is not going to be stripped from NSNumber, new disjunction is going to be `(() -> NSNumber?)?` and `() -> NSNumber?` where in attached example it's going to be `() -> NSNumber?` and `() -> NSNumber` which seems strange... |
It would be really good if we could preserve this particular IUO, even apart from the crash. |
@rudkx I'd like to help with this one but I'd appreciate a pointer, because it seems like we shouldn't always strip way optional from the result type but only when declaration has IOU attribute set otherwise we'd produce a solution which can't be applied to AST, but there is no way to get to declaration from the function type if it's passed as one of the parameters, is that right? |
In this case there's a declaration with an IUO return type (the imported |
…sorry, "and therefore there's no parameter involved". |
@belkadan Yes, that's the case, it's going to be IOU declaration (but it wouldn't have wrapping optional type) and type of the result is going to be optional because we don't allow to write things like (() -> Int) anymore, it's replaced with (() -> Int?)! |
Yes, I get what's happening. It might be worth figuring out a way to model this besides a single type |
@xedin I spent time this afternoon looking at this. It's not an easy fix. I'm going to look at reworking how some of the constraints are set up for IUOs and how some of the rewriting is done. |
@rudkx No problem, I'm going to assign to one to you then. |
Attachment: Download
Environment
Xcode Version 10.0 beta (10L176w)
Additional Detail from JIRA
md5: 5d158e90f50907bcb98263b0fba4fc29
Issue Description:
then usage, segfaulting the compiler with code 11:
one of the workarounds was to add more `?`:
Which kinda makese sense as both method and return value are "optional" in objc declaration, nevertheless diagnostics could be imroved, probably.
Please see example attached.
The text was updated successfully, but these errors were encountered: