Closed
Description
Fail to compile from TASTY
object Test {
def foo: Unit = {
val a: GenericCompanion2[Bar] = null
val b: GenericCompanion2[Baz] = null
List(a, b)
}
}
class GenericCompanion2[+CC[X] <: Foo[X]]
class Foo[A]
class Bar[A] extends Foo[A]
class Baz[A] extends Foo[A]
Can be reproduced with
dotc <source>
dotc -decompile -Ycheck:all Test
checking ./Test.class after phase frontend
exception while typing [a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]] of class class dotty.tools.dotc.ast.Trees$SeqLiteral # 140
exception while typing [a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]* of class class dotty.tools.dotc.ast.Trees$Typed # 142
exception while typing List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
) of class class dotty.tools.dotc.ast.Trees$Apply # 143
exception while typing {
List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
)
()
} of class class dotty.tools.dotc.ast.Trees$Block # 145
exception while typing {
val a: GenericCompanion2[Bar] = null
val b: GenericCompanion2[Baz] = null
{
List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
)
()
}
} of class class dotty.tools.dotc.ast.Trees$Block # 146
exception while typing def foo: Unit =
{
val a: GenericCompanion2[Bar] = null
val b: GenericCompanion2[Baz] = null
{
List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
)
()
}
} of class class dotty.tools.dotc.ast.Trees$DefDef # 33
exception while typing @scala.annotation.internal.SourceFile("tests/pos/hklub0.scala") final module
class
Test () extends Object() { this: Test.type =>
def foo: Unit =
{
val a: GenericCompanion2[Bar] = null
val b: GenericCompanion2[Baz] = null
{
List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
)
()
}
}
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 20
exception while typing package <empty> {
final lazy module val Test: Test = new Test()
@scala.annotation.internal.SourceFile("tests/pos/hklub0.scala") final module
class
Test () extends Object() { this: Test.type =>
def foo: Unit =
{
val a: GenericCompanion2[Bar] = null
val b: GenericCompanion2[Baz] = null
{
List.apply[GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]](
[a,b : GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]]:
GenericCompanion2[[X0] => Bar[X0] | Baz[X0]]*
)
()
}
}
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 27
*** error while checking ./Test.class after phase frontend ***
Exception in thread "main" java.lang.AssertionError: assertion failed: orphan param: X0, hash of binder = 159475521, tree = <empty>, type = AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),<empty>)),GenericCompanion2),List(HKTypeLambda(List(X0), List(TypeBounds(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),scala),Nothing),TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),scala),Any))), OrType(AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),<empty>)),Bar),List(TypeParamRef(X0))),AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),<empty>)),Baz),List(TypeParamRef(X0)))))))
at scala.Predef$.assert(Predef.scala:219)
at dotty.tools.dotc.transform.TreeChecker$$anon$1.apply(TreeChecker.scala:488)
at dotty.tools.dotc.core.Types$TypeMap.$anonfun$mapOver$6(Types.scala:3864)
at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3786)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs$1(Types.scala:3864)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3872)
at dotty.tools.dotc.transform.TreeChecker$$anon$1.apply(TreeChecker.scala:492)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3918)
at dotty.tools.dotc.transform.TreeChecker$$anon$1.apply(TreeChecker.scala:492)
at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda$1(Types.scala:3901)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3903)
at dotty.tools.dotc.transform.TreeChecker$$anon$1.apply(TreeChecker.scala:485)
at dotty.tools.dotc.core.Types$TypeMap.$anonfun$mapOver$6(Types.scala:3864)
at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3786)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs$1(Types.scala:3864)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3872)
at dotty.tools.dotc.transform.TreeChecker$$anon$1.apply(TreeChecker.scala:492)
at dotty.tools.dotc.transform.TreeChecker$.checkNoOrphans(TreeChecker.scala:496)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:288)
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)
at dotty.tools.dotc.typer.Typer.$anonfun$typedSeqLiteral$1(Typer.scala:1088)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedSeqLiteral(Typer.scala:1075)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1696)
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)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1801)
at dotty.tools.dotc.typer.Typer.$anonfun$typedTyped$3(Typer.scala:525)
at dotty.tools.dotc.typer.Typer.cases$1(Typer.scala:509)
at dotty.tools.dotc.typer.Typer.$anonfun$typedTyped$1(Typer.scala:523)
...