Skip to content

Commit be25f43

Browse files
committed
Replace widenDealias.typeSymbol with typeSymbol in backend
1 parent f6f1731 commit be25f43

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
8282
genLoad(rhs, symInfoTK(lhs.symbol))
8383
lineNumber(tree)
8484
// receiverClass is used in the bytecode to access the field. using sym.owner may lead to IllegalAccessError
85-
val receiverClass = qual.tpe.widenDealias.typeSymbol
85+
val receiverClass = qual.tpe.typeSymbol
8686
fieldStore(lhs.symbol, receiverClass)
8787

8888
case Assign(lhs, rhs) =>
@@ -385,7 +385,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
385385
def genLoadQualUnlessElidable(): Unit = { if (!qualSafeToElide) { genLoadQualifier(tree) } }
386386

387387
// receiverClass is used in the bytecode to access the field. using sym.owner may lead to IllegalAccessError
388-
def receiverClass = qualifier.tpe.widenDealias.typeSymbol
388+
def receiverClass = qualifier.tpe.typeSymbol
389389
if (sym.is(Module)) {
390390
genLoadQualUnlessElidable()
391391
genLoadModule(tree)
@@ -806,7 +806,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
806806
val receiverClass = if (!invokeStyle.isVirtual) null else {
807807
// receiverClass is used in the bytecode to as the method receiver. using sym.owner
808808
// may lead to IllegalAccessErrors, see 9954eaf / aladdin bug 455.
809-
val qualSym = qual.tpe.widenDealias.typeSymbol
809+
val qualSym = qual.tpe.typeSymbol
810810
if (qualSym == defn.ArrayClass) {
811811
// For invocations like `Array(1).hashCode` or `.wait()`, use Object as receiver
812812
// in the bytecode. Using the array descriptor (like we do for clone above) seems
@@ -1373,7 +1373,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
13731373
(sym derivesFrom defn.BoxedCharClass) ||
13741374
(sym derivesFrom defn.BoxedBooleanClass)
13751375
}
1376-
!areSameFinals && isMaybeBoxed(l.tpe.widenDealias.typeSymbol) && isMaybeBoxed(r.tpe.widenDealias.typeSymbol)
1376+
!areSameFinals && isMaybeBoxed(l.tpe.typeSymbol) && isMaybeBoxed(r.tpe.typeSymbol)
13771377
}
13781378
def isNull(t: Tree): Boolean = t match {
13791379
case Literal(Constant(null)) => true
@@ -1467,7 +1467,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
14671467
if (invokeStyle != asm.Opcodes.H_INVOKESTATIC) capturedParamsTypes = lambdaTarget.owner.info :: capturedParamsTypes
14681468

14691469
// Requires https://github.com/scala/scala-java8-compat on the runtime classpath
1470-
val returnUnit = lambdaTarget.info.resultType.widenDealias.typeSymbol == defn.UnitClass
1470+
val returnUnit = lambdaTarget.info.resultType.typeSymbol == defn.UnitClass
14711471
val functionalInterfaceDesc: String = generatedType.descriptor
14721472
val desc = capturedParamsTypes.map(tpe => toTypeKind(tpe)).mkString(("("), "", ")") + functionalInterfaceDesc
14731473
// TODO specialization

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
237237
private def initJClass(jclass: asm.ClassVisitor): Unit = {
238238

239239
val ps = claszSymbol.info.parents
240-
val superClass: String = if (ps.isEmpty) ObjectReference.internalName else internalName(ps.head.widenDealias.typeSymbol)
240+
val superClass: String = if (ps.isEmpty) ObjectReference.internalName else internalName(ps.head.typeSymbol)
241241
val interfaceNames0 = classBTypeFromSymbol(claszSymbol).info.interfaces map {
242242
case classBType =>
243243
if (classBType.isNestedClass) { innerClassBufferASM += classBType }

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ class JSCodeGen()(using genCtx: Context) {
15531553
assert(ctor.isClassConstructor,
15541554
"'new' call to non-constructor: " + ctor.name)
15551555

1556-
val clsSym = tpe.widenDealias.typeSymbol
1556+
val clsSym = tpe.typeSymbol
15571557

15581558
if (isHijackedClass(clsSym)) {
15591559
genNewHijackedClass(clsSym, ctor, args.map(genExpr))
@@ -1922,8 +1922,8 @@ class JSCodeGen()(using genCtx: Context) {
19221922
private def genEqEqPrimitive(ltpe: Type, rtpe: Type, lsrc: js.Tree, rsrc: js.Tree)(
19231923
implicit pos: SourcePosition): js.Tree = {
19241924
report.debuglog(s"$ltpe == $rtpe")
1925-
val lsym = ltpe.widenDealias.typeSymbol.asClass
1926-
val rsym = rtpe.widenDealias.typeSymbol.asClass
1925+
val lsym = ltpe.typeSymbol.asClass
1926+
val rsym = rtpe.typeSymbol.asClass
19271927

19281928
/* True if the equality comparison is between values that require the
19291929
* use of the rich equality comparator
@@ -2098,7 +2098,7 @@ class JSCodeGen()(using genCtx: Context) {
20982098
val exception = args.head
20992099
val genException = genExpr(exception)
21002100
js.Throw {
2101-
if (exception.tpe.widenDealias.typeSymbol.derivesFrom(jsdefn.JavaScriptExceptionClass)) {
2101+
if (exception.tpe.typeSymbol.derivesFrom(jsdefn.JavaScriptExceptionClass)) {
21022102
genModuleApplyMethod(
21032103
jsdefn.Runtime_unwrapJavaScriptException,
21042104
List(genException))
@@ -2594,7 +2594,7 @@ class JSCodeGen()(using genCtx: Context) {
25942594
box(call, sym.info.finalResultType)
25952595
}
25962596

2597-
val funInterfaceSym = functionalInterface.tpe.widenDealias.typeSymbol
2597+
val funInterfaceSym = functionalInterface.tpe.typeSymbol
25982598

25992599
if (jsdefn.isJSThisFunctionClass(funInterfaceSym)) {
26002600
val thisParam :: otherParams = formalParams
@@ -2688,7 +2688,7 @@ class JSCodeGen()(using genCtx: Context) {
26882688
private def genAsInstanceOf(value: js.Tree, to: Type)(
26892689
implicit pos: Position): js.Tree = {
26902690

2691-
val sym = to.widenDealias.typeSymbol
2691+
val sym = to.typeSymbol
26922692

26932693
if (sym == defn.ObjectClass || isJSType(sym)) {
26942694
/* asInstanceOf[Object] always succeeds, and
@@ -2716,7 +2716,7 @@ class JSCodeGen()(using genCtx: Context) {
27162716
/** Gen JS code for an isInstanceOf test (for reference types only) */
27172717
private def genIsInstanceOf(value: js.Tree, to: Type)(
27182718
implicit pos: SourcePosition): js.Tree = {
2719-
val sym = to.widenDealias.typeSymbol
2719+
val sym = to.typeSymbol
27202720

27212721
if (sym == defn.ObjectClass) {
27222722
js.BinaryOp(js.BinaryOp.!==, value, js.Null())

0 commit comments

Comments
 (0)