Skip to content

Conversation

aherlihy
Copy link
Contributor

Fixes #24021

untpd.Literal(Constant(nameIdx))),
pt)
if selName == nme.apply then
EmptyTree
Copy link
Contributor

@road21 road21 Oct 15, 2025

Choose a reason for hiding this comment

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

What is the behavior of the following code now:

val boo: NamedTuple.NamedTuple[("_2", "apply"), (Int, Int)] = (1, 2)
println(boo.apply)

I mean, that's too easy to bypass restrictions on named tuple field names. What error will be in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validation doesn't apply to non-standard construction of named tuples (#23360). The compiler team decided that validation should only be applied to named tuples created with the spec (k:V) syntax. Either way of course it should not crash the compiler.

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.

Compiler crashes when named tuple with apply field is used

2 participants