typelevel / scala

Typelevel Scala, a fork of Scala
http://typelevel.org/scala/
372 stars 21 forks source link

Literal type should match Singleton #152

Closed Atry closed 6 years ago

Atry commented 7 years ago
Welcome to the Ammonite Repl 0.9.3
(Scala 2.12.2-bin-typelevel-4 Java 1.8.0_102)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ repl.compiler.settings.YliteralTypes.value = true   
@ Tuple1["foo"]("foo") match {
    case Tuple1(foo: Singleton) => foo
  } 
cmd6.sc:2: pattern type is incompatible with expected type;
 found   : Singleton
 required: "foo"
  case Tuple1(foo: Singleton) => foo
                   ^
Compilation Failed

The error message required: "foo" looks suspicious.

soronpo commented 7 years ago

FYI, works in dotty: https://scastie.scala-lang.org/JaynuT0kQj2FpKKyScbxvw

milessabin commented 6 years ago

Fixed in https://github.com/scala/scala/pull/6150.