Closed
Description
Fail to compile from TASTY
object A { implicit val x: Int = 1 }
object Test1 {
import A.{x => y}
implicitly[Int]
}
Can be reproduced with
dotc <source>
dotc -decompile -Ycheck:all Test
exception while typing implicitly[Int](A.y) of class class dotty.tools.dotc.ast.Trees$Apply # 62
exception while typing val a: Int = implicitly[Int](A.y) of class class dotty.tools.dotc.ast.Trees$ValDef # 57
exception while typing @scala.annotation.internal.SourceFile("tests/pos/t2405.scala") final module
class
Test1 () extends Object() { this: Test1.type =>
import A.
Thicket {
x
y
}
val a: Int = implicitly[Int](A.y)
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 20
exception while typing package <empty> {
final lazy module val Test1: Test1 = new Test1()
@scala.annotation.internal.SourceFile("tests/pos/t2405.scala") final module
class
Test1 () extends Object() { this: Test1.type =>
import A.
Thicket {
x
y
}
val a: Int = implicitly[Int](A.y)
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 27
*** error while checking ./Test1.class after phase frontend ***
Exception in thread "main" java.lang.AssertionError: assertion failed: found: A.y.type
required: Int
tree = A.y
at scala.Predef$.assert(Predef.scala:219)
at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:447)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:242)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:642)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:640)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:412)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:451)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:233)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:543)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:641)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:697)
at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$7(Applications.scala:722)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1809)
at dotty.tools.dotc.typer.Applications.$anonfun$typedApply$1(Applications.scala:723)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:667)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:767)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:665)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:69)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1678)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1727)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:272)
at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)