Skip to content

Pat var must be isVarPattern - #25701

Merged
SolalPirelli merged 1 commit into
scala:mainfrom
som-snytt:issue/25700-pat-regress
Apr 5, 2026
Merged

Pat var must be isVarPattern#25701
SolalPirelli merged 1 commit into
scala:mainfrom
som-snytt:issue/25700-pat-regress

Conversation

@som-snytt

@som-snytt som-snytt commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #25700

How much have you relied on LLM-based tools in this contribution?

But can one rely on LLM-based tools?

How was the solution tested?

Apparently, there was not a test for val def with stable identifier pattern. The ticket minimization supplies it. Edit: a previous test was erroring incorrectly but flew under the radar. Its correct error is restored.

Additional notes

Follow-up to #25566 that tweaked #24972.

Obviously, a pattern variable must be isVarPattern, but the degrees of freedom are lowercase, underscore, and backquoted.

The code comment, that "royal we" want wildcards, suggests our bases are not covered. IdPattern is for parsing and would not be useful here. But how do I ask whether I'm looking at a patvar? There is an attachment. Are we too early or late for it?

"One does not simply ask if an identifier is a pattern variable."

@som-snytt

som-snytt commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

I was mistaken, the test was the one that used to error for each subpattern.

-- [E045] Cyclic Error: /home/amarki/projects/scala3/tests/neg/i4935.scala:2:7 -
2 |  val (A, B) = () // error
  |       ^
  |       Recursive value $2$ needs type

The previous message was

-- Error: tests/neg/i4935.scala:2:6 --------------------------------------------
2 |  val (A, B) = () // error
  |      ^^^^^^
  |      cannot test if value of type Unit is a reference of class Tuple2

The text was not tested, so the change went unnoticed.

This commit restores erroring twice with "not found".

@som-snytt
som-snytt force-pushed the issue/25700-pat-regress branch from 20b6c43 to 4b29068 Compare April 3, 2026 01:43
@som-snytt
som-snytt force-pushed the issue/25700-pat-regress branch from 4b29068 to 400705f Compare April 3, 2026 21:19
@som-snytt
som-snytt marked this pull request as ready for review April 3, 2026 21:19

@SolalPirelli SolalPirelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@SolalPirelli
SolalPirelli merged commit 2c668b5 into scala:main Apr 5, 2026
64 checks passed
@som-snytt
som-snytt deleted the issue/25700-pat-regress branch April 8, 2026 08:54
@WojciechMazur WojciechMazur added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Apr 17, 2026
@WojciechMazur WojciechMazur added this to the 3.8.4 milestone Apr 17, 2026
WojciechMazur pushed a commit that referenced this pull request Apr 18, 2026
Fixes #25700 

## How much have you relied on LLM-based tools in this contribution?

But can one _rely_ on LLM-based tools?

## How was the solution tested?

Apparently, there was not a test for val def with stable identifier
pattern. The ticket minimization supplies it. Edit: a previous test was
erroring incorrectly but flew under the radar. Its correct error is
restored.

## Additional notes

Follow-up to #25566 that tweaked
#24972.

Obviously, a pattern variable must be `isVarPattern`, but the degrees of
freedom are lowercase, underscore, and backquoted.

The code comment, that "royal we" want wildcards, suggests our bases are
not covered. `IdPattern` is for parsing and would not be useful here.
But how do I ask whether I'm looking at a patvar? There is an
attachment. Are we too early or late for it?

"One does not simply ask if an identifier is a pattern variable."
[Cherry-picked 2c668b5]
@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Apr 18, 2026
WojciechMazur added a commit that referenced this pull request Apr 20, 2026
Backports #25701 to the 3.8.4-RC2.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in scalablytyped/converter with unexpected CyclicError

4 participants