Skip to content

Commit c28064c

Browse files
committed
Add comment as doc
1 parent bc2a97d commit c28064c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,18 @@ trait BCodeSkelBuilder extends BCodeHelpers {
116116
// Because the assigments to both the module instance fields, and the fields of the module itself
117117
// are in the <clinit>, these fields can be static + final.
118118

119-
// TODO should we do this transformation earlier, say in Constructors? Or would that just cause
119+
// Should we do this transformation earlier, say in Constructors? Or would that just cause
120120
// pain for scala-{js, native}?
121+
//
122+
// @sjrd (https://github.com/lampepfl/dotty/pull/9181#discussion_r457458205):
123+
// moving that before the back-end would make things significantly more complicated for
124+
// Scala.js and Native. Both have a first-class concept of ModuleClass, and encode the
125+
// singleton pattern of MODULE$ in a completely different way. In the Scala.js IR, there
126+
// even isn't anything that corresponds to MODULE$ per se.
127+
//
128+
// So if you move this before the back-end, then Scala.js and Scala Native will have to
129+
// reverse all the effects of this transformation, which would be counter-productive.
130+
121131

122132
// TODO: enable once we change lazy val encoding
123133
//

0 commit comments

Comments
 (0)