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

Address new warnings with the strict patmat exhaustivity of 2.13.4. #4272

Closed

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Nov 2, 2020

In 2.13.4, the pattern match exhaustivity analysis has become much stricter. It remains active in the presence of non-sealed classes, guards, and custom extractors. This change causes a lot of new warnings in our codebase.

See scala/scala#9140

We address most warnings with @unchecked, but for some we throw more specialized exceptions instead.


Locally tested with

> set resolvers in Global += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
> ++2.13.4-bin-200c122
> testSuite2_13/test:compile # with manual inspection of the warnings
> testSuite2_13/test
> testSuiteEx2_13/test
> compiler2_13/test:compile
> ir2_13/test
> linker2_13/test
> testSuite2_13/bootstrap:test

This refactoring avoids having two similar matches, the second one
depending on the first one.

We also factor out the pattern that adds a code path to
`callStatement` as `addCodePath`.
In 2.13.4, the pattern match exhaustivity analysis has become much
stricter. It remains active in the presence of non-sealed classes,
guards, and custom extractors. This change causes a lot of new
warnings in our codebase.

See scala/scala#9140

We address most warnings with `@unchecked`, but for some we throw
more specialized exceptions instead.
@sjrd sjrd requested a review from gzm0 November 2, 2020 11:20
@sjrd
Copy link
Member Author

sjrd commented Nov 2, 2020

At the Dotty meeting today, the changes in 2.13 were challenged by Martin, so we should wait for a resolution of that before merging here.

@sjrd
Copy link
Member Author

sjrd commented Nov 3, 2020

Looks it might become non-default: scala/scala#9299

@sjrd sjrd mentioned this pull request Nov 5, 2020
@sjrd
Copy link
Member Author

sjrd commented Nov 5, 2020

Superseded by #4276.

@sjrd sjrd closed this Nov 5, 2020
@sjrd sjrd deleted the address-new-strict-patmat-exhaustivity-warns branch November 5, 2020 10:55
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.

None yet

1 participant