Skip to content

Fix #3340: Always throw when casting to scala.Nothing #5874

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

Merged
merged 2 commits into from
Feb 8, 2019

Conversation

nicolasstucki
Copy link
Contributor

When casting to Nothing, rather than relying on the cast to scala.runtime.Nothing$ to throw a ClassCastException we evaluate the qualifier and then thorw. This makes sure that the case null.asInstanceOf[Nothing] (i.e. null.asInstanceOf[scala.runtime.Nothing$] in bytecode) does not succeed.

Also fix #4410.

This fix also aligns with Scala.js #1002 (comment)

@nicolasstucki nicolasstucki merged commit cf6e7a9 into scala:master Feb 8, 2019
@nicolasstucki nicolasstucki deleted the fix-#3340 branch February 8, 2019 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException was delayed throw
2 participants