Skip to content

Commit eaedbca

Browse files
committed
Make <static> flag order-independent at backend
The magic in scalac is order-dependent: https://github.com/scala/scala/pull/7270/files#r221195225 See the previous commit for more detailed info.
1 parent 479fd13 commit eaedbca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import tpd._
3131

3232
import scala.tools.asm
3333
import StdNames.{nme, str}
34-
import NameKinds.{DefaultGetterName, ExpandedName}
34+
import NameKinds.{DefaultGetterName, ExpandedName, LazyBitMapName}
3535
import Names.TermName
3636
import Annotations.Annotation
3737
import Names.Name
@@ -131,8 +131,12 @@ object DottyBackendInterface {
131131

132132
def isStaticConstructor(using Context): Boolean = (sym.isStaticMember && sym.isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR)
133133

134+
/** Fields of static modules will be static at backend */
135+
def isStaticModuleField(using Context): Boolean =
136+
sym.owner.isStaticModuleClass && sym.isField && !sym.name.is(LazyBitMapName)
137+
134138
def isStaticMember(using Context): Boolean = (sym ne NoSymbol) &&
135-
(sym.is(JavaStatic) || sym.isScalaStatic)
139+
(sym.is(JavaStatic) || sym.isScalaStatic || sym.isStaticModuleField)
136140
// guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
137141

138142
/**

0 commit comments

Comments
 (0)