Skip to content
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

Fix case null on non-nullable type in unsafe nulls #13976

Merged
merged 4 commits into from Feb 19, 2022

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Nov 19, 2021

Fix case null => ??? on non-nullable type in unsafe nulls, we should not get Match case Unreachable Warning.

Since we don't have import information after frontend, a StickyKey on match tree is used to pass Unsafe Nulls information to later PatternMatcher Phase.

def test1 =
  val s: String = ???
  s match
    case _: String =>
    // under unsafeNulls, we should not get Match case Unreachable Warning
    case null => 

@noti0na1 noti0na1 changed the title Fix space in unsafe nulls Fix case null on non-nullable type in unsafe nulls Nov 19, 2021
@olhotak olhotak requested review from odersky and removed request for smarter January 13, 2022 11:10
@olhotak olhotak removed the request for review from odersky January 25, 2022 13:49
@olhotak
Copy link
Contributor

olhotak commented Jan 25, 2022

Defer this PR until after #14346 has been considered and either implemented or rejected.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the sticky-key trick will not work if we compile from Tasty. At least we never used attachments to convey info from typer to a phase after pickling, to my knowledge. I believe we can do better by keeping the imports around until PatternMatcher, as suggested by #14346.

Copy link
Contributor

@olhotak olhotak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@noti0na1 noti0na1 assigned odersky and unassigned olhotak and noti0na1 Feb 4, 2022
@odersky odersky merged commit 5061804 into scala:main Feb 19, 2022
@odersky odersky deleted the unsafe-nulls-fix-space branch February 19, 2022 18:13
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants