abeln / dotty

Scala with explicit nulls
https://github.com/abeln/dotty/wiki/scala-with-explicit-nulls
Other
23 stars 2 forks source link

Test failure: tests/run/returning.scala #16

Open abeln opened 5 years ago

abeln commented 5 years ago

Smaller repro of the failure:

 class Foo extends scala.util.control.NoStackTrace {
 }

The problem is that https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#fillInStackTrace() returns a Throwable|JavaNull, but since the standard library is non-boostrapped, there's no type error in NoStackTrace, where there should be one:

https://github.com/scala/scala/blob/v2.12.6/src/library/scala/util/control/NoStackTrace.scala#L24

As a result, when we Ycheck resolveSuper, there's a type error dotc -Ycheck:resolveSuper -Xprint:resolveSuper kk.scala

Exception in thread "main" java.lang.AssertionError: assertion failed: found:    Throwable | JavaNull
required: Throwable
tree = super[Throwable].fillInStackTrace()
java.lang.AssertionError: assertion failed: found:    Throwable | JavaNull
required: Throwable
tree = super[Throwable].fillInStackTrace() while compiling kk.scala
    at scala.Predef$.assert(Predef.scala:219)
    at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.sca
abeln commented 5 years ago

This should be fixed when we port the standard library, but the more general solution will require binary compatibility.

abeln commented 5 years ago

Opened an issue for binary compat: https://github.com/abeln/dotty/issues/17