Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Scala.js 1.10.1. #15713

Merged
merged 3 commits into from
Jul 21, 2022
Merged

Upgrade to Scala.js 1.10.1. #15713

merged 3 commits into from
Jul 21, 2022

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jul 20, 2022

It is fine to do this in a patch version, because

  • The IR version was not changed in 1.10.x.
  • There was no change in the scalajs-library API.

I'm not sure who's available for reviews, these days. Anyone up for it?

Both at call site (for native and non-native JS types) and at
definition sites (for non-native JS types).

Forward port of
scala-js/scala-js@1de54d7
sjrd added 2 commits July 21, 2022 13:43
This cherry-picks recent commits from play-json's main, to support
Scala.js 1.10.1.
It is fine to do this in a patch version, because

* The IR version was not changed in 1.10.x.
* There was no change in the scalajs-library API.
@sjrd
Copy link
Member Author

sjrd commented Jul 21, 2022

@mbovel Would you be available to review this PR, perhaps?

@mbovel
Copy link
Member

mbovel commented Jul 21, 2022

Would that make sense to add a test for this?

diff --git a/sjs-compiler-tests/test/scala/dotty/tools/dotc/ScalaJSCompilationTests.scala b/sjs-compiler-tests/test/scala/dotty/tools/dotc/ScalaJSCompilationTests.scala
index ca4f292568..9cac009eb0 100644
--- a/sjs-compiler-tests/test/scala/dotty/tools/dotc/ScalaJSCompilationTests.scala
+++ b/sjs-compiler-tests/test/scala/dotty/tools/dotc/ScalaJSCompilationTests.scala
@@ -33,6 +33,15 @@ class ScalaJSCompilationTests extends ParallelTesting {
     ).checkExpectedErrors()
   }
 
+  // Positive tests ------------------------------------------------------------
+
+  @Test def posScalaJS: Unit = {
+    implicit val testGroup: TestGroup = TestGroup("posScalaJS")
+    aggregateTests(
+      compileFilesInDir("tests/pos-scalajs", scalaJSOptions),
+    ).checkCompile()
+  }
+
   // Run tests -----------------------------------------------------------------
 
   override protected def shouldSkipTestSource(testSource: TestSource): Boolean =
diff --git a/tests/pos-scalajs/i15419.scala b/tests/pos-scalajs/i15419.scala
new file mode 100644
index 0000000000..0631af5f54
--- /dev/null
+++ b/tests/pos-scalajs/i15419.scala
@@ -0,0 +1,9 @@
+import scala.scalajs.js
+
+@js.native
+trait Bar extends js.Object:
+  def baz(dummy: Unit = js.native): Unit = js.native
+
+def bar: Bar = ???
+
+@main def main = bar.baz()

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, style: did you add the underscore on purpose?

Suggested change
val genStatsAndExpr0 = stats.map(genStat(_)) :+ genStatOrExpr(expr, isStat)
val genStatsAndExpr0 = stats.map(genStat) :+ genStatOrExpr(expr, isStat)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I always add the underscore on purpose. For some reason I don't trust eta expansion 😅

@mbovel mbovel self-requested a review July 21, 2022 15:13
Copy link
Member

@mbovel mbovel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! 😄

@sjrd
Copy link
Member Author

sjrd commented Jul 21, 2022

Would that make sense to add a test for this?

We get the test for free in the upgrade to Scala.js 1.10.1. ;) Since it's part of the test suite of Scala.js 1.10.1.

@mbovel
Copy link
Member

mbovel commented Jul 21, 2022

Would that make sense to add a test for this?

We get the test for free in the upgrade to Scala.js 1.10.1. ;) Since it's part of the test suite of Scala.js 1.10.1.

Oh, I see.

@sjrd sjrd merged commit 634c580 into scala:main Jul 21, 2022
@sjrd sjrd deleted the scalajs-1.10.1 branch July 21, 2022 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants