-
Notifications
You must be signed in to change notification settings - Fork 662
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
Compiler allows comparing a comparable
to a literal number
#1610
Comments
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
@jvoigtlaender Thanks for looking into this. It does look like the same issue. |
Given the code: bug : comparable -> Bool
bug n =
n == 1 The new compiler gives this error:
The first hint could be improved now that it is catching this sort of thing, but it is an error now! |
Thanks!! |
SSCCE
This should fail to compile, but it doesn't:
Running the code doesn't produce a runtime exception, but it does return some strange results.
This bug only occurs when comparing a
comparable
to a literalnumber
(as in, thenumber
is hardcoded). For example, this correctly fails to compile:Environment
Edit: Added environment info
The text was updated successfully, but these errors were encountered: