You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dotty compiler version 0.5.0-bin-SNAPSHOT-git-4fefb64 -- Copyright 2002-2017, LAMP/EPFL
$ cat abc.scala
object Test {
def main(args: Array[String]): Unit = {
val i2s = (x: Int) => ""
assert(asInstanceOf.asInstanceOf[AnyRef => String].apply(null) == "")
val i2i = (x: Int) => x + 1
assert(i2i.asInstanceOf[AnyRef => Int].apply(null) == 1)
}
}
$ dotc abc.scala
-- Error: abc.scala:4:36 -------------------------------------------------------
4 | assert(asInstanceOf.asInstanceOf[AnyRef => String].apply(null) == "")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| class Nothing in package scala does not take type parameters
exception occurred while compiling abc.scala
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$$anon$9 cannot be cast to dotty.tools.dotc.core.Types$MethodType
at dotty.tools.dotc.transform.ElimRepeated.$anonfun$1(ElimRepeated.scala:79)
at dotty.tools.dotc.core.Periods.atPhase(Periods.scala:26)
at dotty.tools.dotc.core.Phases.atPhase(Phases.scala:36)
at dotty.tools.dotc.transform.ElimRepeated.transformApply(ElimRepeated.scala:79)
at dotty.tools.dotc.transform.MegaPhase.goApply(MegaPhase.scala:576)
at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:250)
at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:365)
at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:211)
at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:364)
at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:248)
at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:365)
at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:217)
at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:221)
<snipped>
The text was updated successfully, but these errors were encountered:
--Error: tests/allan/Test.scala:2:27------------------------------------------2|asInstanceOf.asInstanceOf[AnyRef=>String]
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|classNothing in packagescaladoesnottaketypeparameters
one error found
java.lang.RuntimeException:Nonzero exit code returned from runner: 1
Note that if Nothing is not inferred, it compiles: asInstanceOf[Nothing].asInstanceOf[AnyRef => String]
--Error: tests/allan/Test.scala:2:27------------------------------------------2|asInstanceOf.asInstanceOf[AnyRef=>String].apply(null)
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|classNothing in packagescaladoesnottaketypeparameters
exception occurred while compiling tests/allan/Test.scala
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$ErrorType$$anon$4 cannot be cast to dotty.tools.dotc.core.Types$MethodType
at dotty.tools.dotc.transform.ElimRepeated.$anonfun$transformApply$1(ElimRepeated.scala:79)
at dotty.tools.dotc.core.Periods.atPhase(Periods.scala:26)
at dotty.tools.dotc.core.Phases.atPhase(Phases.scala:36)
at dotty.tools.dotc.core.Phases.atPhase$(Phases.scala:35)
at dotty.tools.dotc.core.Contexts$Context.atPhase(Contexts.scala:67)
at dotty.tools.dotc.transform.ElimRepeated.transformApply(ElimRepeated.scala:78)
scalac can compile but dotc crashes.
$ dotc -version
$ cat abc.scala
$ dotc abc.scala
The text was updated successfully, but these errors were encountered: