Skip to content

Use precise type for x in case x @ (_: A, _: B), take 2#26161

Merged
SolalPirelli merged 2 commits into
scala:mainfrom
dotty-staging:solal/widen-problem-alt
Jun 3, 2026
Merged

Use precise type for x in case x @ (_: A, _: B), take 2#26161
SolalPirelli merged 2 commits into
scala:mainfrom
dotty-staging:solal/widen-problem-alt

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

Fixes #25544

Alternate for #25734

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

Not at all

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

local1 => val local inObj: Obj[In] & Repr[In]
local2 => val local outObj: Obj[Out] & Repr[Out]
local1 => val local inObj: Obj[In]
local2 => val local outObj: Obj[Out]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the source is case (inObj: Obj[In], outObj: Obj[Out]) so this makes sense to me

val newSelArgs = unadaptedArgs.zip(selArgs).map:
case (Typed(_, tpt: AppliedTypeTree), t) =>
// However, we can't do that if the args changed, e.g., if the args were patterns
typed(tpt) match
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

compared to take 1, we at least use the result of this, and no longer need to check hasType

Copy link
Copy Markdown
Member

@noti0na1 noti0na1 left a comment

Choose a reason for hiding this comment

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

LGTM. Hope we will have a more clean desugar in the future~

@SolalPirelli SolalPirelli merged commit 7954ffc into scala:main Jun 3, 2026
49 of 50 checks passed
@SolalPirelli SolalPirelli deleted the solal/widen-problem-alt branch June 3, 2026 15:21
@SolalPirelli SolalPirelli added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Jun 3, 2026
@SolalPirelli SolalPirelli added this to the 3.9.0 milestone Jun 3, 2026
@SolalPirelli
Copy link
Copy Markdown
Contributor Author

Nominating for backport because it fixes a regression

@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 Jun 6, 2026
WojciechMazur added a commit that referenced this pull request Jun 7, 2026
…" to 3.9.0 (#26251)

Backports #26161 to the 3.9.0-RC1.

PR submitted by the release tooling.
@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 Jun 7, 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.

@unchecked tuple destructuring is now ignored

3 participants