Skip to content

Commit 21e499c

Browse files
committed
Consider module accessor a JSGetter
Redundant on 2.11, but required for the upcoming 2.12.0-RC1, where the field refactoring synthesizes module accessors after uncurry, so that their type history does not even go back as far as uncurry, where a NullaryMethodType might have been observed otherwise. I tried splicing NMTs in the info history of modules, but they already are pretty hacking (a module's term symbol is converted into a method pretty late in the game, and it would be risky to have them start with NMTs from namers).
1 parent 8bc6b43 commit 21e499c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/main/scala/org/scalajs/core/compiler/JSGlobalAddons.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ trait JSGlobalAddons extends JSDefinitions
108108

109109
/** has this symbol to be translated into a JS getter (both directions)? */
110110
def isJSGetter(sym: Symbol): Boolean = {
111-
sym.tpe.params.isEmpty && enteringUncurryIfAtPhaseAfter {
111+
/* We only get here when `sym.isMethod`, thus `sym.isModule` implies that
112+
* `sym` is the module's accessor. In 2.12, module accessors are synthesized
113+
* after uncurry, thus their first info is a MethodType at phase fields.
114+
*/
115+
sym.isModule || (sym.tpe.params.isEmpty && enteringUncurryIfAtPhaseAfter {
112116
sym.tpe match {
113117
case _: NullaryMethodType => true
114118
case PolyType(_, _: NullaryMethodType) => true
115119
case _ => false
116120
}
117-
}
121+
})
118122
}
119123

120124
/** has this symbol to be translated into a JS setter (both directions)? */

0 commit comments

Comments
 (0)