Skip to content

Commit

Permalink
Merge pull request scala#15713 from dotty-staging/scalajs-1.10.1
Browse files Browse the repository at this point in the history
Upgrade to Scala.js 1.10.1.
  • Loading branch information
sjrd committed Jul 21, 2022
2 parents 8e309b0 + ad8eaf7 commit 634c580
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion community-build/community-projects/play-json
10 changes: 9 additions & 1 deletion compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,15 @@ class JSCodeGen()(using genCtx: Context) {
}

case Block(stats, expr) =>
js.Block(stats.map(genStat) :+ genStatOrExpr(expr, isStat))
// #15419 Collapse { <undefined-param>; BoxedUnit } to <undefined-param>
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 {
Expand Down
8 changes: 7 additions & 1 deletion compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
},
)
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 634c580

Please sign in to comment.