-
Notifications
You must be signed in to change notification settings - Fork 21
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
isInstanceOf and type matching give inconsistent results #1698
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1698?orig=1 |
@lrytz said: |
@odersky said: Specifically, the unqualified type name I propose to change this as follows: Specifically, the unqualified type name |
@odersky said: |
@odersky said: case Foo() and case _: Foo did different things. But case Foo() is certainly case this.Foo and I see no need nor way to change this. So I think pattern matching stays like it is. As for asInstanceOf I tend to think it should also stay as it is (i.e. inconsistent with pattern matching), and that for two reasons:
Compared to these I find the correspondence between isInstanceOf and pattern matching I reassign to me so that the spec gets updated. But comments are of course welcome. |
@paulp said: It's even sort of convenient to have isInstanceOf doing a less strict check, so I won't argue that either. I have to say 90% of my scala debugging time (for bugs in my own code anyway) ends up coming down to code which looks like it does one thing and actually does something else. Shadowing being by far the biggest culprit here. |
Please see #1683 for background. In summary:
At present this prints true/false. It needs to print either false/false or true/true. As indicated in #1683 I believe true/true is the better choice.
The text was updated successfully, but these errors were encountered: