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

Check all bindings exhaustively, e.g. tuples components #9147

Merged
merged 1 commit into from Aug 18, 2020

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Aug 2, 2020

With this fix the exhaustivity checker now emits exhaustivity warnings for tuples (and possibly other pattern matches that were affected).

Fixes scala/bug#10019

Technically

The change to drop the null checks (introducing
TreeMakersToPropsIgnoreNullChecks) over-reached and got rid of all the
Vars that those null-checks were referencing. So, instead of that,
finish honouring the modelNull option in removeVarEq.

@scala-jenkins scala-jenkins added this to the 2.12.13 milestone Aug 2, 2020
@dwijnand dwijnand requested a review from retronym August 2, 2020 19:46
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Aug 4, 2020
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

LGTM for what I can say - this area of the compiler is completely new to me and I didn't spend enough time to understand it in detail.

The change to drop the null checks (introducing
`TreeMakersToPropsIgnoreNullChecks`) over-reached and got rid of all the
Vars that those null-checks were referencing.  So, instead of that,
finish honouring the `modelNull` option in `removeVarEq`.
@lrytz lrytz merged commit 1de5f17 into scala:2.12.x Aug 18, 2020
@dwijnand dwijnand deleted the exhaust-tuple branch August 18, 2020 15:53
dongjoon-hyun added a commit to apache/spark that referenced this pull request Nov 24, 2020
### What changes were proposed in this pull request?

This PR aims the followings.
1. Upgrade from Scala 2.13.3 to 2.13.4 for Apache Spark 3.1
2. Fix exhaustivity issues in both Scala 2.12/2.13 (Scala 2.13.4 requires this for compilation.)
3. Enforce the improved exhaustive check by using the existing Scala 2.13 GitHub Action compilation job.

### Why are the changes needed?

Scala 2.13.4 is a maintenance release for 2.13 line and improves JDK 15 support.
- https://github.com/scala/scala/releases/tag/v2.13.4

Also, it improves exhaustivity check.
- scala/scala#9140 (Check exhaustivity of pattern matches with "if" guards and custom extractors)
- scala/scala#9147 (Check all bindings exhaustively, e.g. tuples components)

### Does this PR introduce _any_ user-facing change?

Yep. Although it's a maintenance version change, it's a Scala version change.

### How was this patch tested?

Pass the CIs and do the manual testing.
- Scala 2.12 CI jobs(GitHub Action/Jenkins UT/Jenkins K8s IT) to check the validity of code change.
- Scala 2.13 Compilation job to check the compilation

Closes #30455 from dongjoon-hyun/SCALA_3.13.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
finaglehelper pushed a commit to twitter/util that referenced this pull request Jan 29, 2021
Problem

Supporting latest https://github.com/scala/scala/releases/tag/v2.12.13 includes
a feature change in the scala compiler that will fail to compile when case
matching is not exhaustive on tuples.

Issues
- scala/bug#10680
- scala/bug#10373
- scala/bug#10019

Resolved
- scala/scala#9163
- scala/scala#9147

Solution
Add `case _ => throw new MatchError` to case matching statement that is
non-exhaustive

JIRA Issues: SCALA-25

Differential Revision: https://phabricator.twitter.biz/D609046
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
4 participants