Closed
Description
Compiler version
3.5.0-RC4 and others
Minimized code
//> using scala 3.5.0-RC4, 3.nightly
import scala.language.experimental.namedTuples
class Test[S <: String & Singleton](name: S):
type NT = NamedTuple.NamedTuple[Tuple1[S], Tuple1[Int]]
def nt: NT = ???
type Name = S
type NT2 = NamedTuple.NamedTuple[Tuple1[Name], Tuple1[Int]]
def nt2: NT2 = ???
@main def main =
val foo = new Test("bar")
foo.nt.bar // works
foo.nt2.bar // fails
Output
Compiling project (Scala 3.5.0-RC4, JVM (8))
[error] .\test.scala:21:11
[error] Malformed NamedTuple: names must be string types, but foo.Name was found.
[error] foo.nt2.bar // fails
[error] ^
Error compiling project (Scala 3.5.0-RC4, JVM (8))
Expectation
Successful compilation.