Skip to content

Commit 634c580

Browse files
authored
Merge pull request #15713 from dotty-staging/scalajs-1.10.1
Upgrade to Scala.js 1.10.1.
2 parents 8e309b0 + ad8eaf7 commit 634c580

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,15 @@ class JSCodeGen()(using genCtx: Context) {
18291829
}
18301830

18311831
case Block(stats, expr) =>
1832-
js.Block(stats.map(genStat) :+ genStatOrExpr(expr, isStat))
1832+
// #15419 Collapse { <undefined-param>; BoxedUnit } to <undefined-param>
1833+
val genStatsAndExpr0 = stats.map(genStat(_)) :+ genStatOrExpr(expr, isStat)
1834+
val genStatsAndExpr = genStatsAndExpr0 match {
1835+
case (undefParam @ js.Transient(UndefinedParam)) :: js.Undefined() :: Nil =>
1836+
undefParam :: Nil
1837+
case _ =>
1838+
genStatsAndExpr0
1839+
}
1840+
js.Block(genStatsAndExpr)
18331841

18341842
case Typed(expr, _) =>
18351843
expr match {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) {
761761
// Pass previous arguments to defaultGetter
762762
val defaultGetterArgs = previousArgsValues(defaultGetter.info.paramInfoss.head.size)
763763

764-
if (targetSym.isJSType) {
764+
val callGetter = if (targetSym.isJSType) {
765765
if (defaultGetter.owner.isNonNativeJSClass) {
766766
if (defaultGetter.hasAnnotation(jsdefn.JSOptionalAnnot))
767767
js.Undefined()
@@ -784,6 +784,12 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) {
784784
} else {
785785
genApplyMethod(targetTree, defaultGetter, defaultGetterArgs)
786786
}
787+
788+
// #15419 If the getter returns void, we must "box" it by returning undefined
789+
if (callGetter.tpe == jstpe.NoType)
790+
js.Block(callGetter, js.Undefined())
791+
else
792+
callGetter
787793
}
788794

789795
private def targetSymForDefaultGetter(sym: Symbol): Symbol =

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ object Build {
12201220
++ (dir / "js/src/test/require-2.12" ** "*.scala").get
12211221
++ (dir / "js/src/test/require-sam" ** "*.scala").get
12221222
++ (dir / "js/src/test/scala-new-collections" ** "*.scala").get
1223+
++ (dir / "js/src/test/require-no-modules" ** "*.scala").get
12231224
)
12241225
},
12251226
)

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// e.g. addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")
44

5-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
5+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
66

77
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
88

0 commit comments

Comments
 (0)