diff --git a/community-build/community-projects/play-json b/community-build/community-projects/play-json index 8a221e6465b5..1ca0fab05b44 160000 --- a/community-build/community-projects/play-json +++ b/community-build/community-projects/play-json @@ -1 +1 @@ -Subproject commit 8a221e6465b5139f46e63dd20957e5dcb2c73019 +Subproject commit 1ca0fab05b449580dc591da32bfce680e2e0705e diff --git a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala index 745e53693c83..96608a565adc 100644 --- a/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala +++ b/compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala @@ -1829,7 +1829,15 @@ class JSCodeGen()(using genCtx: Context) { } case Block(stats, expr) => - js.Block(stats.map(genStat) :+ genStatOrExpr(expr, isStat)) + // #15419 Collapse { ; BoxedUnit } to + val genStatsAndExpr0 = stats.map(genStat(_)) :+ genStatOrExpr(expr, isStat) + val genStatsAndExpr = genStatsAndExpr0 match { + case (undefParam @ js.Transient(UndefinedParam)) :: js.Undefined() :: Nil => + undefParam :: Nil + case _ => + genStatsAndExpr0 + } + js.Block(genStatsAndExpr) case Typed(expr, _) => expr match { diff --git a/compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala b/compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala index a163915d8d75..0884ec19b53e 100644 --- a/compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala +++ b/compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala @@ -761,7 +761,7 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) { // Pass previous arguments to defaultGetter val defaultGetterArgs = previousArgsValues(defaultGetter.info.paramInfoss.head.size) - if (targetSym.isJSType) { + val callGetter = if (targetSym.isJSType) { if (defaultGetter.owner.isNonNativeJSClass) { if (defaultGetter.hasAnnotation(jsdefn.JSOptionalAnnot)) js.Undefined() @@ -784,6 +784,12 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) { } else { genApplyMethod(targetTree, defaultGetter, defaultGetterArgs) } + + // #15419 If the getter returns void, we must "box" it by returning undefined + if (callGetter.tpe == jstpe.NoType) + js.Block(callGetter, js.Undefined()) + else + callGetter } private def targetSymForDefaultGetter(sym: Symbol): Symbol = diff --git a/project/Build.scala b/project/Build.scala index fb5dabf25080..453b34901807 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1220,6 +1220,7 @@ object Build { ++ (dir / "js/src/test/require-2.12" ** "*.scala").get ++ (dir / "js/src/test/require-sam" ** "*.scala").get ++ (dir / "js/src/test/scala-new-collections" ** "*.scala").get + ++ (dir / "js/src/test/require-no-modules" ** "*.scala").get ) }, ) diff --git a/project/plugins.sbt b/project/plugins.sbt index bb43d75d44da..b6bc5f1184b6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ // // e.g. addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")