Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix .toTuple insertion #22028

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Fix .toTuple insertion #22028

merged 2 commits into from
Nov 29, 2024

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 26, 2024

SIP 58 postulates an implicit insertion ot .toTuple when the target is a tuple and the source is a named tuple. This was previously not fully implemented. The implementation did not follow aliases or upper bounds when deciding whether something was a named tuple. This is fixed in this PR.

It previously did not follow aliases or upper bounds when deciding
whether something was a named tuple.
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle left a comment

Choose a reason for hiding this comment

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

Should we replace all usages of isNamedTupleType with derivesFromNamedTuple?
There is Implicits#viewExists as a contender in particular.

@odersky
Copy link
Contributor Author

odersky commented Nov 26, 2024

I had a look at all occurrences of isNamedTuple and applied tweaks that looked reasonable.

@WojciechMazur
Copy link
Contributor

Do you think we should backport it to 3.6.2 or can it wait for 3.6.3? For me it looks like a candidate for RC3 backport

@odersky
Copy link
Contributor Author

odersky commented Nov 26, 2024 via email

@odersky odersky merged commit a582b27 into scala:main Nov 29, 2024
29 checks passed
@odersky odersky deleted the fix-implicit-toTuple branch November 29, 2024 16:47
WojciechMazur added a commit that referenced this pull request Nov 30, 2024
…#22059)

Because of the change from #22045, the test
`tests/pos/named-tuple-downcast.scala` from #22028 need to be updated
with `import scala.language.experimental.namedTuples`.

Fix #22058
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.

3 participants