Skip to content

Commit ff091be

Browse files
committed
Workaround dotty deviation in for loop patterns.
1 parent 1838eb0 commit ff091be

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
}
@@ -802,7 +806,8 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
802806
def primitiveOrClassToBType(sym: Symbol): BType = {
803807
assert(sym.isClass, sym)
804808
assert(sym != ArrayClass || isCompilingArray, sym)
805-
primitiveTypeMap.getOrElse(sym, storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol]))
809+
primitiveTypeMap.getOrElse(sym.asInstanceOf[ct.bTypes.coreBTypes.bTypes.int.Symbol],
810+
storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])).asInstanceOf[BType]
806811
}
807812

808813
/**
@@ -811,7 +816,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
811816
*/
812817
def nonClassTypeRefToBType(sym: Symbol): ClassBType = {
813818
assert(sym.isType && isCompilingArray, sym)
814-
ObjectReference
819+
ObjectReference.asInstanceOf[ct.bTypes.ClassBType]
815820
}
816821

817822
tp.widenDealias match {
@@ -856,7 +861,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
856861
"If possible, please file a bug on issues.scala-lang.org.")
857862

858863
tp match {
859-
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
864+
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
860865
case ThisType(sym) => storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])
861866
// case t: SingletonType => primitiveOrClassToBType(t.classSymbol)
862867
case t: SingletonType => t.underlying.toTypeKind(ct)(storage)

0 commit comments

Comments
 (0)