fix: enable strict-unsealed-patmat lint and fix exhaustiveness warnings#3330
Draft
He-Pin wants to merge 1 commit into
Draft
fix: enable strict-unsealed-patmat lint and fix exhaustiveness warnings#3330He-Pin wants to merge 1 commit into
He-Pin wants to merge 1 commit into
Conversation
Motivation: The strict-unsealed-patmat lint was disabled globally in #264 to unblock the build, leaving many pattern matches on non-sealed traits unchecked. Issue #265 tracks re-enabling this lint. Modification: Remove the -Xlint:-strict-unsealed-patmat silencing flag from PekkoDisciplinePlugin for Scala 2.13. Fix all resulting exhaustiveness warnings across the codebase: - Seal Command traits where all subtypes are in the same file - Add @nowarn annotations where traits are intentionally non-sealed (cross-file protocols in tutorials) - Add catch-all cases for matches on OptionVal and other extractor-only types (Collections, stream operators) Result: The strict-unsealed-patmat lint is now active for Scala 2.13, catching future pattern match exhaustiveness issues at compile time. Tests: sbt "docs / Test / compile" — success, no exhaustiveness errors References: Fixes #265
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Issue #265 tracks re-enabling the
strict-unsealed-patmatlint that was disabled globally in #264 to unblock the build. This lint catches pattern matches on non-sealed traits that may not be exhaustive, a class of bugs that should be caught at compile time.Modification
Remove the
-Xlint:-strict-unsealed-patmatsilencing flag fromPekkoDisciplinePluginfor Scala 2.13 and fix all resulting exhaustiveness warnings across the codebase:@nowarnannotations where traits are intentionally non-sealed for cross-file protocols (tutorials 4 & 5:DeviceGroup.Command,DeviceGroupQuery.Command)OptionValand other extractor-only types (Collections,UnfoldResourceSourceAsync,DropRepeated,GroupedAdjacentByWeighted,Switch)unapply(ShardRegionStats,CurrentShardRegionState,AllDeadLetters)20 files changed across actor, stream, docs, test, and bench-jmh modules.
Result
The
strict-unsealed-patmatlint is now active for Scala 2.13, catching future pattern match exhaustiveness issues at compile time. No behavioral changes to production code — all catch-all cases are unreachable and marked as such.Tests
sbt "docs / Test / compile"— success, no exhaustiveness errorsReferences
Fixes #265