Skip to content

NamedTuple.Names and NamedTuple.DropNames not working as expected #21194

@kavedaa

Description

@kavedaa

Compiler version

3.5.0-RC3

Minimized code

//> using scala 3.5.0-RC3, 3.nightly

import scala.language.experimental.namedTuples

object Test:

  val bar = (a = "hello", b = 1)

  summon[NamedTuple.Names[bar.type] <:< ("a", "b")]
    
  summon[NamedTuple.DropNames[bar.type] <:< (String, Int)]

Output

Compiling project (Scala 3.5.0-RC3, JVM (8))
[error] .\test.scala:9:52
[error] Cannot prove that NamedTupleDecomposition.Names[(Test.bar : (a : String, b : Int))] <:< (("a" : String), ("b" : String)).
[error]
[error] Note: a match type could not be fully reduced:
[error]
[error]   trying to reduce  NamedTupleDecomposition.Names[(Test.bar : (a : String, b : Int))]
[error]   failed since selector (Test.bar : (a : String, b : Int))
[error]   does not match  case NamedTuple.NamedTuple[n, _] => n
[error]   and cannot be shown to be disjoint from it either.
[error]   summon[NamedTuple.Names[bar.type] <:< ("a", "b")]
[error]                                                    ^
[error] .\test.scala:11:59
[error] Cannot prove that NamedTupleDecomposition.DropNames[(Test.bar : (a : String, b : Int))] <:< (String, Int).
[error]
[error] Note: a match type could not be fully reduced:
[error]
[error]   trying to reduce  NamedTupleDecomposition.DropNames[(Test.bar : (a : String, b : Int))]
[error]   failed since selector (Test.bar : (a : String, b : Int))
[error]   does not match  case NamedTuple.NamedTuple[_, x] => x
[error]   and cannot be shown to be disjoint from it either.
[error]   summon[NamedTuple.DropNames[bar.type] <:< (String, Int)]
[error]                                                           ^
Error compiling project (Scala 3.5.0-RC3, JVM (8))

Expectation

Successful compilation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions