Skip to content

Commit 3a0dbda

Browse files
committed
Revert "Remove DottyBackendInterface Symbol and type"
This reverts commit 60b220e.
1 parent 504adde commit 3a0dbda

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
354354
av.visit(name, const.stringValue) // `stringValue` special-cases null, but that execution path isn't exercised for a const with StringTag
355355
case ClazzTag => av.visit(name, typeToTypeKind(const.typeValue)(bcodeStore)(innerClasesStore).toASMType)
356356
case EnumTag =>
357-
val edesc = innerClasesStore.typeDescriptor(const.tpe) // the class descriptor of the enumeration class.
357+
val edesc = innerClasesStore.typeDescriptor(const.tpe.asInstanceOf[bcodeStore.int.Type]) // the class descriptor of the enumeration class.
358358
val evalue = const.symbolValue.name.mangledString // value the actual enumeration value.
359359
av.visitEnum(name, edesc, evalue)
360360
}
@@ -363,7 +363,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
363363
case Ident(nme.WILDCARD) =>
364364
// An underscore argument indicates that we want to use the default value for this parameter, so do not emit anything
365365
case t: tpd.RefTree if t.symbol.denot.owner.isAllOf(Flags.JavaEnumTrait) =>
366-
val edesc = innerClasesStore.typeDescriptor(t.tpe) // the class descriptor of the enumeration class.
366+
val edesc = innerClasesStore.typeDescriptor(t.tpe.asInstanceOf[bcodeStore.int.Type]) // the class descriptor of the enumeration class.
367367
val evalue = t.symbol.name.mangledString // value the actual enumeration value.
368368
av.visitEnum(name, edesc, evalue)
369369
case t: SeqLiteral =>
@@ -405,7 +405,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
405405
case t @ Apply(constr, args) if t.tpe.derivesFrom(JavaAnnotationClass) =>
406406
val typ = t.tpe.classSymbol.denot.info
407407
val assocs = assocsFromApply(t)
408-
val desc = innerClasesStore.typeDescriptor(typ) // the class descriptor of the nested annotation class
408+
val desc = innerClasesStore.typeDescriptor(typ.asInstanceOf[bcodeStore.int.Type]) // the class descriptor of the nested annotation class
409409
val nestedVisitor = av.visitAnnotation(name, desc)
410410
emitAssocs(nestedVisitor, assocs, bcodeStore)(innerClasesStore)
411411

@@ -756,8 +756,8 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
756756
def primitiveOrClassToBType(sym: Symbol): BType = {
757757
assert(sym.isClass, sym)
758758
assert(sym != defn.ArrayClass || ctx.compilationUnit.source.file.name == "Array.scala", sym)
759-
primitiveTypeMap.getOrElse(sym,
760-
storage.getClassBTypeAndRegisterInnerClass(sym)).asInstanceOf[BType]
759+
primitiveTypeMap.getOrElse(sym.asInstanceOf[ct.bTypes.coreBTypes.bTypes.int.Symbol],
760+
storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])).asInstanceOf[BType]
761761
}
762762

763763
/**
@@ -809,7 +809,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
809809

810810
tp match {
811811
case tp: ThisType if tp.cls == defn.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
812-
case tp: ThisType => storage.getClassBTypeAndRegisterInnerClass(tp.cls)
812+
case tp: ThisType => storage.getClassBTypeAndRegisterInnerClass(tp.cls.asInstanceOf[ct.int.Symbol])
813813
// case t: SingletonType => primitiveOrClassToBType(t.classSymbol)
814814
case t: SingletonType => typeToTypeKind(t.underlying)(ct)(storage)
815815
case t: RefinedType => typeToTypeKind(t.parent)(ct)(storage) //parents.map(_.toTypeKind(ct)(storage).asClassBType).reduceLeft((a, b) => a.jvmWiseLUB(b))

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import dotty.tools.dotc.core.Decorators._
1616
import dotty.tools.dotc.core.Flags
1717
import dotty.tools.dotc.core.StdNames.str
1818
import dotty.tools.dotc.core.Symbols._
19-
import dotty.tools.dotc.core.Types.Type
2019
import dotty.tools.dotc.util.Spans._
2120

2221
/*

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
4040
// they would be shadowed by the more deeply nested `symHelper` decorator.
4141

4242

43+
type Symbol = Symbols.Symbol
44+
type Type = Types.Type
45+
4346
// require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always.
4447
@threadUnsafe lazy val LambdaMetaFactory: ClassSymbol = ctx.requiredClass("java.lang.invoke.LambdaMetafactory")
4548
@threadUnsafe lazy val MethodHandle: ClassSymbol = ctx.requiredClass("java.lang.invoke.MethodHandle")

0 commit comments

Comments
 (0)