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

Improve type inference for literal named tuples #20497

Merged
merged 1 commit into from
May 30, 2024

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented May 30, 2024

Adds a new NamedTuple.build method which fixes the types of the labels first, as suggested in #20456 (comment)

It requires language.experimental.clauseInterleaving language import.

Keeps withNames as a friendlier option for end-users

fixes #20456

@bishabosha bishabosha requested a review from odersky May 30, 2024 12:39
@bishabosha bishabosha changed the title Named tuples inferrence Improve type inference for literal named tuples May 30, 2024
library/src/scala/NamedTuple.scala Show resolved Hide resolved
library/src/scala/NamedTuple.scala Outdated Show resolved Hide resolved
@odersky odersky assigned bishabosha and unassigned odersky May 30, 2024
@bishabosha bishabosha force-pushed the named-tuples-inferrence branch from 97ab3de to bf0cd3c Compare May 30, 2024 15:02
@bishabosha bishabosha requested a review from odersky May 30, 2024 15:27
@bishabosha bishabosha assigned odersky and unassigned bishabosha May 30, 2024
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

LGTM!

@odersky odersky merged commit 01b404f into scala:main May 30, 2024
19 checks passed
@odersky odersky deleted the named-tuples-inferrence branch May 30, 2024 17:40
bishabosha added a commit that referenced this pull request Jun 2, 2024
As mentioned in #20267, the new desugaring from
#20497 seems to fix the issue

fixes #20267
@Kordyjan Kordyjan added this to the 3.5.1 milestone Jul 3, 2024
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.

Function Arguments of named tuples can't infer param types despite explicit type
3 participants