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
The example starts working again if either AnyVal or F[_] is removed, or PartialFunction is changed to Function1 or implicit class is converted to Scala 3 extension method, but it also fails without implicit keyword.
Output (click arrow to expand)
Compiling project (Scala 3.3.1, JVM)
Error: Error while emitting /Users/grzegorzbielski/projects/my/delete-me/Main.scala
assertion failed: Unexpected alias type: type F
Error compiling project (Scala 3.3.1, JVM)
Compilation failed
Full stack trace:
java.lang.AssertionError: assertion failed: Unexpected alias type:typeF
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.transform.GenericSignatures$.jsig$1(GenericSignatures.scala:261)
at dotty.tools.dotc.transform.GenericSignatures$.boxedSig$1(GenericSignatures.scala:68)
at dotty.tools.dotc.transform.GenericSignatures$.argSig$1(GenericSignatures.scala:195)
at dotty.tools.dotc.transform.GenericSignatures$.classSig$1$$anonfun$1(GenericSignatures.scala:229)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.transform.GenericSignatures$.classSig$1(GenericSignatures.scala:229)
at dotty.tools.dotc.transform.GenericSignatures$.jsig$1(GenericSignatures.scala:288)
at dotty.tools.dotc.transform.GenericSignatures$.boxedSig$1(GenericSignatures.scala:68)
at dotty.tools.dotc.transform.GenericSignatures$.superSig$1$$anonfun$1(GenericSignatures.scala:65)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.transform.GenericSignatures$.superSig$1(GenericSignatures.scala:65)
at dotty.tools.dotc.transform.GenericSignatures$.jsig$1(GenericSignatures.scala:348)
at dotty.tools.dotc.transform.GenericSignatures$.javaSig0(GenericSignatures.scala:365)
at dotty.tools.dotc.transform.GenericSignatures$.javaSig(GenericSignatures.scala:40)
at dotty.tools.backend.jvm.BCodeHelpers.dotty$tools$backend$jvm$BCodeHelpers$$getGenericSignatureHelper(BCodeHelpers.scala:773)
at dotty.tools.backend.jvm.BCodeHelpers$BCJGenSigGen.getGenericSignature(BCodeHelpers.scala:400)
at dotty.tools.backend.jvm.BCodeHelpers$BCJGenSigGen.getGenericSignature$(BCodeHelpers.scala:381)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.getGenericSignature(BCodeSkelBuilder.scala:74)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.initJClass(BCodeSkelBuilder.scala:273)
at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:123)
at dotty.tools.backend.jvm.CodeGen.genClass(CodeGen.scala:138)
at dotty.tools.backend.jvm.CodeGen.genClassDef$1(CodeGen.scala:55)
at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:101)
at dotty.tools.backend.jvm.CodeGen.genClassDefs$1$$anonfun$1(CodeGen.scala:99)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.backend.jvm.CodeGen.genClassDefs$1(CodeGen.scala:99)
at dotty.tools.backend.jvm.CodeGen.genUnit(CodeGen.scala:104)
at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:76)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
at scala.collection.immutable.List.map(List.scala:246)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:87)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
at dotty.tools.dotc.Run.compileSources(Run.scala:194)
at dotty.tools.dotc.Run.compile(Run.scala:179)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:197)
at dotty.tools.dotc.Driver.process(Driver.scala:165)
at dotty.tools.dotc.Driver.process(Driver.scala:177)
at dotty.tools.dotc.Driver.main(Driver.scala:207)
at dotty.tools.dotc.Main.main(Main.scala)
Errorwhile emitting /Users/grzegorzbielski/projects/my/dotty-error-delete-me/Main.scala
assertion failed: Unexpected alias type:typeF1 error found
Compilation failed
The text was updated successfully, but these errors were encountered:
Very slightly minimized (no implicit), and with different names for F in Arb (Fx) than in def pf (Fy). The crash is about Fy:
traitArb[Fx[_]]:defpure[A](x: A):Fx[A]
classPfOps(self: Int) extendsAnyVal {
defpf[Fy[_]](m: Arb[Fy]):PartialFunction[Int, Fy[Int]] = {
case x => m.pure(x)
}
}
This happens during the back-end, when generating Java generic signatures. I suspect it's trying to compute the type of a synthetic method that lacks proper erasure, for some reason.
Contrary to what an earlier comment said, we do emit HK type
parameters in Java signatures. They are always unbounded and never
the type of values.
However, they can appear as type arguments to other higher-kinded
types. Previously, an assertion error would trigger in that
situation. We relax the assertion to allow this situation and
emit a correct Java signature.
I manually verified that the generated Java signatures are
consistent with what Scala 2 emits for the same code snippet.
sjrd
linked a pull request
Nov 9, 2023
that will
close
this issue
Contrary to what an earlier comment said, we do emit HK type parameters
in Java signatures. They are always unbounded and never the type of
values.
However, they can appear as type arguments to other higher-kinded types.
Previously, an assertion error would trigger in that situation. We relax
the assertion to allow this situation and emit a correct Java signature.
I manually verified that the generated Java signatures are consistent
with what Scala 2 emits for the same code snippet.
Compiler version
3.3.1
Minimized code
The example starts working again if either
AnyVal
orF[_]
is removed, orPartialFunction
is changed toFunction1
orimplicit class
is converted to Scala 3 extension method, but it also fails withoutimplicit
keyword.Output (click arrow to expand)
Full stack trace:
The text was updated successfully, but these errors were encountered: