Skip to content

Named Tuple key validation not applied to Tuple[] syntax #23360

Closed
@aherlihy

Description

@aherlihy

From #23155

Compiler version

3.7.2-RC1-bin-SNAPSHOT

Minimized code

Seems no named tuple key validation occurs at all when not using the explicit syntax:

  val explicit: (_1: Int, _1: Int) = ??? // error, both for the duplicate and "_1" cannot be a named tuple selector because clashes with regular tuple selectors
  val viaTupleN: NamedTuple.NamedTuple[Tuple2["_1", "_1"], Tuple2[Int, Int]] = ??? //  no error
  val viaTupleExpl: NamedTuple.NamedTuple[("_1", "_1"), (Int, Int)] = ??? // no error
  val viaCons: NamedTuple.NamedTuple["_1" *: "_1" *: EmptyTuple, Int *: Int *: EmptyTuple] = ???  // no error

Do we want to ensure we're checking for any key name restrictions on the desugared tuples, or document that the NamedTuple syntax shouldn't be used in user code directly?

Metadata

Metadata

Assignees

Labels

area:named-tuplesIssues tied to the named tuples feature.itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions