lampepfl/dotty — pull request #134 by samuelgruetter (2014-05-14 13:45:37+00:00)
Title: Warn if cast between incompatible primitive types

When I try to cast Unit to Char, I should get a warning at compile time:

```scala
object Unit2Char extends App {
val y: Unit = ()
// Will throw java.lang.ClassCastException: scala.runtime.BoxedUnit cannot be cast to java.lang.Character
// Should emit warning at compile time
val x: Char = y.asInstanceOf[Char]
println("cast was successful: " + x) // will not happen
}
```

There is already code for this in TypeTestsCasts and in tpd.primitiveConversion, but it never prints the expected warning. This PR fixes that.