-
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-910] Type Int1 does not conform to protocol BooleanType #43522
Comments
Actually the error seems to be caused by me forgetting that the whiteColor and blackColor are static methods not static variables of UIColor and should therefore be called with (). Even given that though the error message is awful. |
I'm getting a similar thing with ternary operator and dictionaries, seeing it occasionally for the past 6 months. |
Comment by Paris Xavier Pinkney (JIRA) I've just uploaded a sample playground that reproduces this bug In the playground, I have two nested functions, |
Comment by Zak Jacobson (JIRA) pxpgraphics (JIRA User) there's a typo in your playground - I hope that's not the cause of your bug! In: .GreaterTham <– m/n |
Comment by Paris Xavier Pinkney (JIRA) zoosnack (JIRA User) oh wow, my mistake. yes, that is the cause of my bug. |
Comment by Zak Jacobson (JIRA) Awesome pxpgraphics (JIRA User)]! Glad to help. |
We no longer produce a diagnostic talking about Int1, but it's still not ideal: "Ambiguous reference to member '<'". @xedin Want to take a look? |
@swift-ci create |
Comment by Mike Choi (JIRA) @slavapestov Just to be clear on what should be happening, should the
message be something like
|
mkchoi212 (JIRA User) Here is the example in question:
Currently on master is produces following diagnostic - "reference to member 'LessThan' cannot be resolved without a contextual type" but it actually should say that there is no such member |
@xedin In this case there's usually a leftover conversion constraint that we can use as a contextual type. Is it worth it to dig it out of the constraint system and type check the branches of the IfExpr with that as the target conversion type? |
@CodaFi Yes, in this case it should be easy to do too because correct type is going to be contextual type of the constraint system. |
Comment by Mike Choi (JIRA) @xedin Just fixed the bug. I decided to place the test under |
mkchoi212 (JIRA User) Yes, that's fine! |
Comment by Mike Choi (JIRA) I've submitted a pull request for this issue: #11531 |
mkchoi212 (JIRA User) Can you screen SR-2623 and see if its the same issue? |
Sorry, I meant SR-2326. |
mkchoi212 (JIRA User) It's similar yes, it should says that type-checking of ".foo" and ".bar" |
Comment by Mike Choi (JIRA) |
Thank you, mkchoi212 (JIRA User)! |
Attachment: Download
Environment
Xcode Version 7.3 beta (7D162j) - default toolchain
Additional Detail from JIRA
md5: 0f2b3b38cf100f64f01b9de240c15935
Issue Description:
[NOTE - See comment below. The .whiteColor and .blackColor methods were not actually being called as they should have been. The error message is still very bad though so I'm not resolving the issue.]
Compile error "Type 'Int1' does not conform to protocol 'BooleanType'" is occurring when I don't think it should. First encountered in application code but the below example has the same error in the Playground.
This isn't quite the minimal sample where this is happening but it is getting close. The error does disappear at some point in simplification even when I don't think that the types should fundamentally change.
The text was updated successfully, but these errors were encountered: