Skip to content

Support -Wunused:patvars on Scala 3#255

Merged
lenguyenthanh merged 2 commits into
typelevel:mainfrom
kubukoz:warn-unused-patvars-scala3
May 16, 2026
Merged

Support -Wunused:patvars on Scala 3#255
lenguyenthanh merged 2 commits into
typelevel:mainfrom
kubukoz:warn-unused-patvars-scala3

Conversation

@kubukoz
Copy link
Copy Markdown
Member

@kubukoz kubukoz commented May 15, 2026

Summary

  • Enable -Wunused:patvars on Scala 3 versions where the safe variant is available
  • Earlier Scala 3 versions only offered -Wunused:unsafe-warn-patvars, which this library does not expose
  • The safe -Wunused:patvars was forward-ported from Scala 2 in 3.7.0 (scala/scala3#20894) and backported to the 3.3 LTS in 3.3.7 (scala/scala3-lts#223)

The resulting gating is [2.13.0, 3.0.0) ∪ [3.3.7, 3.4.0) ∪ [3.7.0, ∞).

Note: the LTS PR description claims it was backported "to the 3.3.6", but that PR did not actually ship in 3.3.6 — it landed in 3.3.7 (confirmed in the 3.3.7 release notes which list #20894 under "Highlights").

Test plan

  • Added unit tests covering each boundary (2.13, 3.0.0, 3.3.0, 3.3.6, 3.3.7, 3.4.0, 3.6.x, 3.7.0, 3.8.x)
  • Verified empirically with scala-cli: -Wunused:patvars is rejected on 3.3.6 and 3.6.4, accepted on 3.3.7 and 3.7.0
  • sbt libJVM/test passes (26/26)

🤖 Generated with Claude Code

kubukoz and others added 2 commits May 15, 2026 23:43
The safe `-Wunused:patvars` was forward-ported from Scala 2 in 3.7.0
(scala/scala3#20894) and backported to the 3.3 LTS in 3.3.7
(scala/scala3-lts#223). Earlier 3.x only offered the unsafe variant
`-Wunused:unsafe-warn-patvars`, which is not exposed by this library.

Verified empirically with scala-cli: rejected on 3.3.6 and 3.6.4,
accepted on 3.3.7 and 3.7.0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kubukoz
Copy link
Copy Markdown
Member Author

kubukoz commented May 15, 2026

@lenguyenthanh 🙏 I'll follow up with an sbt-tpolecat PR, unless you want a draft before this is merged

Copy link
Copy Markdown
Member

@lenguyenthanh lenguyenthanh left a comment

Choose a reason for hiding this comment

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

thanks! the release note isn't clear about this change at all. I bet a lot of people miss this.

@lenguyenthanh lenguyenthanh merged commit 501c5ee into typelevel:main May 16, 2026
10 checks passed
@kubukoz kubukoz deleted the warn-unused-patvars-scala3 branch May 18, 2026 15:07
@kubukoz
Copy link
Copy Markdown
Member Author

kubukoz commented May 18, 2026

thanks! the release note isn't clear about this change at all. I bet a lot of people miss this.

at least it's automatically available in -Wunused:all!

@kubukoz
Copy link
Copy Markdown
Member Author

kubukoz commented May 18, 2026

@lenguyenthanh can you make a release?

btw. happy to help with some routine maintenance stuff

@lenguyenthanh
Copy link
Copy Markdown
Member

lenguyenthanh commented May 19, 2026

@lenguyenthanh can you make a release?

yeah, I'll make one now

btw. happy to help with some routine maintenance stuff

thanks a lot, and hey @armanbilge, we have a volunteer 😄

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.

2 participants