Skip to content

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

Closed
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/widen-problem
Closed

Use precise type for x in case x @ (_: A, _: B)#25734
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/widen-problem

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

Fixes #25544

I'm not a big fan of this, but it works, so it's a good first step in getting someone to tell me why it's actually bad and what should be done instead :)

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

as much as som-snytt does

How was the solution tested?

issue regression test

@SolalPirelli SolalPirelli requested a review from noti0na1 April 9, 2026 07:40
@SolalPirelli SolalPirelli added the needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button label Apr 14, 2026
@SolalPirelli
Copy link
Copy Markdown
Contributor Author

@noti0na1 how bad do you think this is? it works and I have no other idea but I don't like it that much

@SolalPirelli
Copy link
Copy Markdown
Contributor Author

ping @sjrd / @noti0na1

@noti0na1
Copy link
Copy Markdown
Member

I don't have specific opinion on this issue, I don't like the fix neither...

@SolalPirelli SolalPirelli force-pushed the solal/widen-problem branch from d812ec3 to 1f51b09 Compare May 21, 2026 14:42
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

local0 => val local out: Repr[Out]
local1 => val local inObj: Obj[In] & Repr[In]
local2 => val local outObj: Obj[Out] & Repr[Out]
local1 => val local inObj: Obj[In]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isnt this suspicious - it is now a less precise type? unless Obj is already Repr

@bishabosha
Copy link
Copy Markdown
Member

should probably ask some GADT experts

@SolalPirelli SolalPirelli requested a review from Linyxus May 22, 2026 08:34
Copy link
Copy Markdown
Contributor

@Linyxus Linyxus left a comment

Choose a reason for hiding this comment

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

It doesn't look wrong to me, but indeed feels quite adhoc and hacky.

@SolalPirelli
Copy link
Copy Markdown
Contributor Author

Closing in favor of #26161 which is slightly less bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-squashing PR whose commits should be squashed by the author or via the "Squash and Merge" button

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@unchecked tuple destructuring is now ignored

4 participants