Closed
Description
https://github.com/lampepfl/dotty/blob/master/tests/neg/i1802.scala should be a pos
test, there is a type that gets infered to Nothing
where the type should be inferred and is inferred in scalac.
The minimized version this issue is:
object Exception {
def mkCatcher[Ex](isDef: Ex => Boolean) = ???
def mkThrowableCatcher(isDef: Throwable => Boolean) = mkCatcher(isDef)
}
With dotc -Xprint:frontend
:
package <empty> {
import scala.reflect.ClassTag
final lazy module val Exception: Exception$ = new Exception$()
final module class Exception$() extends Object() { this: Exception.type =>
def mkCatcher[Ex](isDef: Function1[Ex, Boolean]): Nothing = ???
def mkThrowableCatcher(isDef: Function1[Throwable, Boolean]): Nothing =
Exception.mkCatcher[Nothing^](isDef)
}
}
Note the Nothing
in Exception.mkCatcher[Nothing^](isDef)
. This is what causes the Nothing
classtag in neg/ i1802.scala
and scala.util.control.Exception
.
With scalac -Xprint:typer
package <empty> {
object Exception extends scala.AnyRef {
def <init>(): Exception.type = {
Exception.super.<init>();
()
};
def mkCatcher[Ex](isDef: Ex => Boolean): Nothing = scala.this.Predef.???;
def mkThrowableCatcher(isDef: Throwable => Boolean): Nothing = Exception.this.mkCatcher[Throwable](isDef)
}
}