Skip to content

Commit 266a7c5

Browse files
committed
Move method
1 parent 5795716 commit 266a7c5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11441144
val isTraitMethodOverridingObjectMember = {
11451145
receiver != methodOwner && // fast path - the boolean is used to pick either of these two, if they are the same it does not matter
11461146
style.isVirtual &&
1147-
symHelper(receiver).isEmittedInterface &&
1147+
isEmittedInterface(receiver) &&
11481148
defn.ObjectType.decl(method.name).symbol.exists && { // fast path - compute overrideChain on the next line only if necessary
11491149
val syms = method.allOverriddenSymbols.toList
11501150
!syms.isEmpty && syms.last.owner == defn.ObjectClass
@@ -1160,7 +1160,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11601160
val bmType = asmMethodType(method)
11611161
val mdescr = bmType.descriptor
11621162

1163-
val isInterface = symHelper(receiverClass).isEmittedInterface
1163+
val isInterface = isEmittedInterface(receiverClass)
11641164
import InvokeStyle._
11651165
if (style == Super) {
11661166
// DOTTY: this differ from how super-calls in traits are handled in the scalac backend,
@@ -1435,7 +1435,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
14351435
// Lambdas should be serializable if they implement a SAM that extends Serializable or if they
14361436
// implement a scala.Function* class.
14371437
val isSerializable = functionalInterface.isSerializable || defn.isFunctionClass(functionalInterface)
1438-
val isInterface = symHelper(lambdaTarget.owner).isEmittedInterface
1438+
val isInterface = isEmittedInterface(lambdaTarget.owner)
14391439
val invokeStyle =
14401440
if (lambdaTarget.isStaticMember) asm.Opcodes.H_INVOKESTATIC
14411441
else if (lambdaTarget.is(Flags.Private) || lambdaTarget.isClassConstructor) asm.Opcodes.H_INVOKESPECIAL
@@ -1494,6 +1494,16 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
14941494
generatedType
14951495
}
14961496
}
1497+
1498+
/** Does this symbol actually correspond to an interface that will be emitted?
1499+
* In the backend, this should be preferred over `isInterface` because it
1500+
* also returns true for the symbols of the fake companion objects we
1501+
* create for Java-defined classes as well as for Java annotations
1502+
* which we represent as classes.
1503+
*/
1504+
private def isEmittedInterface(sym: Symbol): Boolean = sym.isInterface ||
1505+
sym.is(Flags.JavaDefined) && (toDenot(sym).isAnnotation || sym.is(Flags.ModuleClass) && (sym.companionClass.is(Flags.PureInterface)) || sym.companionClass.is(Flags.Trait))
1506+
14971507
}
14981508

14991509
object BCodeBodyBuilder {

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
249249

250250
// tests
251251

252-
/** Does this symbol actually correspond to an interface that will be emitted?
253-
* In the backend, this should be preferred over `isInterface` because it
254-
* also returns true for the symbols of the fake companion objects we
255-
* create for Java-defined classes as well as for Java annotations
256-
* which we represent as classes.
257-
*/
258-
def isEmittedInterface: Boolean = sym.isInterface ||
259-
sym.is(Flags.JavaDefined) && (toDenot(sym).isAnnotation || sym.is(Flags.ModuleClass) && (sym.companionClass.is(Flags.PureInterface)) || sym.companionClass.is(Flags.Trait))
260-
261-
262252

263253
// navigation
264254

0 commit comments

Comments
 (0)