Skip to content

Commit 03593ca

Browse files
committed
Workaround dotty deviation in for loop patterns.
1 parent 2e642f6 commit 03593ca

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,12 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
308308

309309
private def emitAssocs(av: asm.AnnotationVisitor, assocs: List[(Name, Object)], bcodeStore: BCodeHelpers)
310310
(innerClasesStore: bcodeStore.BCInnerClassGen) = {
311-
for ((name, value) <- assocs) {
312-
emitArgument(av, name.toString(), value.asInstanceOf[Tree], bcodeStore)(innerClasesStore)
311+
//for ((name, value) <- assocs) { // dotty deviation, does not work
312+
313+
for (nv <- assocs) {
314+
val name = nv._1
315+
val value = nv._2
316+
emitArgument(av, name.toString, value.asInstanceOf[Tree], bcodeStore)(innerClasesStore)
313317
}
314318
av.visitEnd()
315319
}
@@ -786,7 +790,8 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
786790
def primitiveOrClassToBType(sym: Symbol): BType = {
787791
assert(sym.isClass, sym)
788792
assert(sym != ArrayClass || isCompilingArray, sym)
789-
primitiveTypeMap.getOrElse(sym, storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol]))
793+
primitiveTypeMap.getOrElse(sym.asInstanceOf[ct.bTypes.coreBTypes.bTypes.int.Symbol],
794+
storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])).asInstanceOf[BType]
790795
}
791796

792797
/**
@@ -795,7 +800,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
795800
*/
796801
def nonClassTypeRefToBType(sym: Symbol): ClassBType = {
797802
assert(sym.isType && isCompilingArray, sym)
798-
ObjectReference
803+
ObjectReference.asInstanceOf[ct.bTypes.ClassBType]
799804
}
800805

801806
tp.widenDealias match {
@@ -840,7 +845,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
840845
"If possible, please file a bug on issues.scala-lang.org.")
841846

842847
tp match {
843-
case ThisType(ArrayClass) => ObjectReference // was introduced in 9b17332f11 to fix SI-999, but this code is not reached in its test, or any other test
848+
case ThisType(ArrayClass) => ObjectReference.asInstanceOf[ct.bTypes.ClassBType] // was introduced in 9b17332f11 to fix SI-999, but this code is not reached in its test, or any other test
844849
case ThisType(sym) => storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])
845850
// case t: SingletonType => primitiveOrClassToBType(t.classSymbol)
846851
case t: SingletonType => t.underlying.toTypeKind(ct)(storage)

0 commit comments

Comments
 (0)