You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classContainer:// needs to be wrapped in a classenumColorextends java.lang.Enum[Color]:caseRed, Green, Blue
Output (click arrow to expand)
an unexpected typerepresentation reached the compiler backend while compiling Container.scala:MethodType(List(), List(), TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class<empty>)),classContainer)),classContainer$Color)). If possible, please file a bug on https://github.com/lampepfl/dotty/issues
Errorwhile emitting Container.scala
exception occurred while compiling Container.scala
scala.MatchError:MethodType(List(), List(), TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class<empty>)),classContainer)),classContainer$Color)) (of classdotty.tools.dotc.core.Types$CachedMethodType) while compiling Container.scala
Exception in thread "main" scala.MatchError:MethodType(List(), List(), TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class<empty>)),classContainer)),classContainer$Color)) (of classdotty.tools.dotc.core.Types$CachedMethodType)
at dotty.tools.backend.jvm.BCodeHelpers.dotty$tools$backend$jvm$BCodeHelpers$$typeToTypeKind(BCodeHelpers.scala:850)
at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind(BCodeHelpers.scala:299)
at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind$(BCodeHelpers.scala:210)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.toTypeKind(BCodeSkelBuilder.scala:58)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.symInfoTK(BCodeSkelBuilder.scala:87)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.addClassFields$$anonfun$2(BCodeSkelBuilder.scala:268)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.addClassFields(BCodeSkelBuilder.scala:274)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:134)
at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:224)
at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:191)
at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:521)
at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:487)
at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:57)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:295)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:296)
at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:61)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:181)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:191)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:199)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
at dotty.tools.dotc.Run.compileUnits(Run.scala:206)
at dotty.tools.dotc.Run.compileSources(Run.scala:143)
at dotty.tools.dotc.Run.compile(Run.scala:125)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
at dotty.tools.dotc.Driver.process(Driver.scala:195)
at dotty.tools.dotc.Driver.process(Driver.scala:164)
at dotty.tools.dotc.Driver.process(Driver.scala:176)
at dotty.tools.dotc.Driver.main(Driver.scala:203)
at dotty.tools.dotc.Main.main(Main.scala)
Notes
with -Ycheck:completeJavaEnums we get the assertion failure: "non member selection of getter Red in object Color from Container.this.Color.type in Color.this.$outer.Color.Red while compiling Container.scala"
checking Container.scala after phase MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
exception while typing @scala.annotation.static() <static> valRed: ():Container.this.Color=Color.this.$outer.Color.Red of classclass dotty.tools.dotc.ast.Trees$ValDef#2002
exception while typing @scala.annotation.internal.Child[
(Container.Color.Blue: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Green: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Red: ():Container.this.Color)
]() sealedabstractclassColor($outer: Container, _$name: String,
_$ordinal: Int
) extendsEnum, Enum {
super(Color.this._$name, Color.this._$ordinal)
defproductIterator(): scala.collection.Iterator=super[Product].productIterator()
defproductPrefix():String=super[Product].productPrefix()
defproductElementName(n: Int):String=super[Product].productElementName(n)
defproductElementNames(): scala.collection.Iterator=super[Product].productElementNames()
privateval$outer:Containerval_$name:Stringval_$ordinal:Int@scala.annotation.static() <static> valRed: ():Container.this.Color=Color.this.$outer.Color.Red@scala.annotation.static() <static> valGreen: ():Container.this.Color=Color.this.$outer.Color.Green@scala.annotation.static() <static> valBlue: ():Container.this.Color=Color.this.$outer.Color.BluefinaldefContainer$Color$$$outer():Container=Color.this.$outer
} of classclass dotty.tools.dotc.ast.Trees$TypeDef#2064
exception while typing @scala.annotation.internal.SourceFile("Container.scala") classContainer()
extendsObject {
super()
@scala.annotation.internal.Child[
(Container.Color.Blue: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Green: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Red: ():Container.this.Color)
]() sealedabstractclassColor($outer: Container, _$name: String,
_$ordinal: Int
) extendsEnum, Enum {
super(Color.this._$name, Color.this._$ordinal)
defproductIterator(): scala.collection.Iterator=super[Product].productIterator()
defproductPrefix():String=super[Product].productPrefix()
defproductElementName(n: Int):String=super[Product].productElementName(n)
defproductElementNames(): scala.collection.Iterator=super[Product].productElementNames()
privateval$outer:Containerval_$name:Stringval_$ordinal:Int@scala.annotation.static() <static> valRed: ():Container.this.Color=Color.this.$outer.Color.Red@scala.annotation.static() <static> valGreen: ():Container.this.Color=Color.this.$outer.Color.Green@scala.annotation.static() <static> valBlue: ():Container.this.Color=Color.this.$outer.Color.BluefinaldefContainer$Color$$$outer():Container=Color.this.$outer
}
valColor$lzy1:Container.this.Color$ =newContainer.this.Color$(this)
finallazy module defColor():Container.this.Color$ =this.Color$lzy1
final module classColor$($outer: Container) extendsObject,
java.io.Serializable
, scala.deriving.Mirror.Sum {
super()
defvalues():Container.this.Color[] =this.$values.values().toArray(
scala.reflect.ClassTag.apply(classOf[Container.this.Color])
).asInstanceOf[Container.this.Color[]]
privateval$values: scala.runtime.EnumValues=new scala.runtime.EnumValues()
defvalueOf($name: String):Container.this.Color=trythis.$values.fromName().apply($name).asInstanceOf[Container.this.Color]
catch
{
case ex$ @ _:java.util.NoSuchElementException=>thrownewIllegalArgumentException("key not found: ".concat($name))
}
privatedef$new(_$ordinal: Int, $name: String):Container.this.Color=
{
finalclass$anon($outer: Container.this.Color$) extendsContainer.this.Color
, scala.runtime.EnumValue, scala.deriving.Mirror.Singleton {
super(this.$outer.Container$Color$$$$outer(), $name, _$ordinal)
overridedefcanEqual(that: Object):Boolean=super[EnumValue].canEqual(that)
overridedefproductArity():Int=super[EnumValue].productArity()
overridedefproductPrefix():String=super[EnumValue].productPrefix()
overridedefproductElement(n: Int):Object=super[EnumValue].productElement(n)
overridedefproductElementName(n: Int):String=super[EnumValue].productElementName(n)
deffromProduct(p: Product): scala.deriving.Mirror.Singleton=super[Singleton].fromProduct(p)
def$ordinal():Int= _$ordinal
overridedeftoString():String= $name
this.$outer.$values.register(this)
privateval$outer:Container.this.Color$
finaldefContainer$Color$_$$anon$$$outer():Container.this.Color$ =
$outer
deffromProduct(p: Product):Object=this.fromProduct(p)
}
newContainer.this.Colorwith scala.runtime.EnumValuewith
scala.deriving.Mirror.Singleton
{...}
(this):Container.this.Color
}
privatevalRed:Container.this.Color=this.$new(0, "Red")
casedefRed():Container.this.Color=this.RedprivatevalGreen:Container.this.Color=this.$new(1, "Green")
casedefGreen():Container.this.Color=this.GreenprivatevalBlue:Container.this.Color=this.$new(2, "Blue")
casedefBlue():Container.this.Color=this.Bluedefordinal(x$0: Container.this.Color):Int= x$0.ordinal()
privateval$outer:ContainerfinaldefContainer$Color$$$$outer():Container=Container.Color.$outer
defordinal(x: Object):Int=this.ordinal(x.asInstanceOf[Container.this.Color])
}
} of classclass dotty.tools.dotc.ast.Trees$TypeDef#2187
exception while typing package<empty> {
@scala.annotation.internal.SourceFile("Container.scala") classContainer()
extendsObject {
super()
@scala.annotation.internal.Child[
(Container.Color.Blue: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Green: ():Container.this.Color)
]() @scala.annotation.internal.Child[
(Container.Color.Red: ():Container.this.Color)
]() sealedabstractclassColor($outer: Container, _$name: String,
_$ordinal: Int
) extendsEnum, Enum {
super(Color.this._$name, Color.this._$ordinal)
defproductIterator(): scala.collection.Iterator=super[Product].productIterator()
defproductPrefix():String=super[Product].productPrefix()
defproductElementName(n: Int):String=super[Product].productElementName(n)
defproductElementNames(): scala.collection.Iterator=super[Product].productElementNames()
privateval$outer:Containerval_$name:Stringval_$ordinal:Int@scala.annotation.static() <static> valRed: ():Container.this.Color=Color.this.$outer.Color.Red@scala.annotation.static() <static> valGreen: ():Container.this.Color=Color.this.$outer.Color.Green@scala.annotation.static() <static> valBlue: ():Container.this.Color=Color.this.$outer.Color.BluefinaldefContainer$Color$$$outer():Container=Color.this.$outer
}
valColor$lzy1:Container.this.Color$ =newContainer.this.Color$(this)
finallazy module defColor():Container.this.Color$ =this.Color$lzy1
final module classColor$($outer: Container) extendsObject,
java.io.Serializable
, scala.deriving.Mirror.Sum {
super()
defvalues():Container.this.Color[] =this.$values.values().toArray(
scala.reflect.ClassTag.apply(classOf[Container.this.Color])
).asInstanceOf[Container.this.Color[]]
privateval$values: scala.runtime.EnumValues=new scala.runtime.EnumValues()
defvalueOf($name: String):Container.this.Color=trythis.$values.fromName().apply($name).asInstanceOf[Container.this.Color
]
catch
{
case ex$ @ _:java.util.NoSuchElementException=>thrownewIllegalArgumentException("key not found: ".concat($name))
}
privatedef$new(_$ordinal: Int, $name: String):Container.this.Color=
{
finalclass$anon($outer: Container.this.Color$) extendsContainer.this.Color
, scala.runtime.EnumValue, scala.deriving.Mirror.Singleton {
super(this.$outer.Container$Color$$$$outer(), $name, _$ordinal)
overridedefcanEqual(that: Object):Boolean=super[EnumValue].canEqual(that)
overridedefproductArity():Int=super[EnumValue].productArity()
overridedefproductPrefix():String=super[EnumValue].productPrefix()
overridedefproductElement(n: Int):Object=super[EnumValue].productElement(n)
overridedefproductElementName(n: Int):String=super[EnumValue].productElementName(n)
deffromProduct(p: Product): scala.deriving.Mirror.Singleton=super[Singleton].fromProduct(p)
def$ordinal():Int= _$ordinal
overridedeftoString():String= $name
this.$outer.$values.register(this)
privateval$outer:Container.this.Color$
finaldefContainer$Color$_$$anon$$$outer():Container.this.Color$
=
$outer
deffromProduct(p: Product):Object=this.fromProduct(p)
}
newContainer.this.Colorwith scala.runtime.EnumValuewith
scala.deriving.Mirror.Singleton
{...}
(this):Container.this.Color
}
privatevalRed:Container.this.Color=this.$new(0, "Red")
casedefRed():Container.this.Color=this.RedprivatevalGreen:Container.this.Color=this.$new(1, "Green")
casedefGreen():Container.this.Color=this.GreenprivatevalBlue:Container.this.Color=this.$new(2, "Blue")
casedefBlue():Container.this.Color=this.Bluedefordinal(x$0: Container.this.Color):Int= x$0.ordinal()
privateval$outer:ContainerfinaldefContainer$Color$$$$outer():Container=Container.Color.$outer
defordinal(x: Object):Int=this.ordinal(x.asInstanceOf[Container.this.Color])
}
}
} of classclass dotty.tools.dotc.ast.Trees$PackageDef#2188*** error while checking Container.scala after phase capturedVars ***
exception occurred while compiling Container.scala
java.lang.AssertionError: assertion failed: non member selection of getter Red in objectColor from Container.this.Color.type in Color.this.$outer.Color.Redwhile compiling Container.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: non member selection of getter Red in objectColor from Container.this.Color.type in Color.this.$outer.Color.Red
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.transform.FirstTransform.checkPostCondition(FirstTransform.scala:69)
at dotty.tools.dotc.transform.TreeChecker.dotty$tools$dotc$transform$TreeChecker$Checker$$_$typedUnadapted$$anonfun$1(TreeChecker.scala:350)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:350)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:317)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2671)
at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1900)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2397)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:122)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:333)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:317)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2579)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2627)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:516)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2081)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:448)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2411)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2415)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:122)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:333)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:317)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2579)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2627)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:516)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2081)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:448)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2411)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2415)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2483)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:122)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:333)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:317)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2579)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2627)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:516)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2207)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2455)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2484)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:122)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:333)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2553)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2554)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2557)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:317)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2671)
at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:151)
at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:120)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:295)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:296)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:181)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:191)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:199)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
at dotty.tools.dotc.Run.compileUnits(Run.scala:206)
at dotty.tools.dotc.Run.compileSources(Run.scala:143)
at dotty.tools.dotc.Run.compile(Run.scala:125)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
at dotty.tools.dotc.Driver.process(Driver.scala:195)
at dotty.tools.dotc.Driver.process(Driver.scala:164)
at dotty.tools.dotc.Driver.process(Driver.scala:176)
at dotty.tools.dotc.Driver.main(Driver.scala:203)
at dotty.tools.dotc.Main.main(Main.scala)
The text was updated successfully, but these errors were encountered:
Minimized code
Output (click arrow to expand)
Notes
with
-Ycheck:completeJavaEnums
we get the assertion failure: "non member selection of getter Red in object Color from Container.this.Color.type in Color.this.$outer.Color.Red while compiling Container.scala"The text was updated successfully, but these errors were encountered: