Skip to content

Commit f3e1021

Browse files
committed
Bump Scala 3 Next RC to 3.8.0-RC1
1 parent 2ca7333 commit f3e1021

File tree

13 files changed

+285
-209
lines changed

13 files changed

+285
-209
lines changed

build.mill.scala

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ object `scala-cli-bsp` extends JavaModule with ScalaCliPublishModule {
115115
override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Seq(
116116
Deps.bsp4j
117117
)
118-
override def javacOptions: T[Seq[String]] = Task {
119-
super.javacOptions() ++ Seq("-target", "8", "-source", "8")
120-
}
121118
}
122119
object integration extends CliIntegration {
123120
object test extends IntegrationScalaTests {
@@ -773,14 +770,7 @@ trait Build extends ScalaCliCrossSbtModule
773770

774771
trait SpecificationLevel extends ScalaCliCrossSbtModule
775772
with ScalaCliPublishModule {
776-
override def crossScalaVersion: String = crossValue
777-
override def scalacOptions: T[Seq[String]] = Task {
778-
val isScala213 = crossScalaVersion.startsWith("2.13.")
779-
val extraOptions =
780-
if (isScala213) Seq("-Xsource:3")
781-
else Nil
782-
super.scalacOptions() ++ extraOptions ++ Seq("-release", "8")
783-
}
773+
override def crossScalaVersion: String = crossValue
784774
}
785775

786776
trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers
@@ -1038,6 +1028,10 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
10381028
| def scala3Next = "${Scala.scala3Next}"
10391029
| def scala3NextAnnounced = "${Scala.scala3NextAnnounced}"
10401030
| def defaultScala = "${Scala.defaultUser}"
1031+
| def scala38Versions = Seq(${Scala.scala38Versions
1032+
.sorted
1033+
.map(s => s"\"$s\"")
1034+
.mkString(", ")})
10411035
| def defaultScalafmtVersion = "${Deps.scalafmtCli.dep.versionConstraint.asString}"
10421036
| def maxAmmoniteScala212Version = "${Scala.maxAmmoniteScala212Version}"
10431037
| def maxAmmoniteScala213Version = "${Scala.maxAmmoniteScala213Version}"
@@ -1240,7 +1234,7 @@ trait Runner extends CrossSbtModule
12401234
with ScalaCliPublishModule
12411235
with ScalaCliScalafixModule {
12421236
override def scalacOptions: T[Seq[String]] = Task {
1243-
super.scalacOptions() ++ Seq("-release", "8", "-deprecation")
1237+
super.scalacOptions() ++ Seq("-deprecation")
12441238
}
12451239
override def mainClass: T[Option[String]] = Some("scala.cli.runner.Runner")
12461240
override def sources: T[Seq[PathRef]] = Task.Sources {
@@ -1255,7 +1249,7 @@ trait TestRunner extends CrossSbtModule
12551249
with ScalaCliPublishModule
12561250
with ScalaCliScalafixModule {
12571251
override def scalacOptions: T[Seq[String]] = Task {
1258-
super.scalacOptions() ++ Seq("-release", "8", "-deprecation")
1252+
super.scalacOptions() ++ Seq("-deprecation")
12591253
}
12601254
override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg(
12611255
Deps.asm,

modules/build/src/test/scala/scala/build/tests/SourceGeneratorTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.eed3si9n.expecty.Expecty.expect
44

55
import scala.Console.println
66
import scala.build.Ops.EitherThrowOps
7-
import scala.build.options.{BuildOptions, InternalOptions, Scope}
7+
import scala.build.options.{BuildOptions, InternalOptions}
88
import scala.build.tests.util.BloopServer
99
import scala.build.{Build, BuildThreads, Directories, LocalRepo, Position}
1010

modules/config/src/main/scala/scala/cli/config/Keys.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
package scala.cli.config
2-
3-
import com.github.plokhotnyuk.jsoniter_scala.core.Key as _
4-
52
import scala.cli.commands.SpecificationLevel
63

74
object Keys {

modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,17 @@ abstract class BspTestDefinitions extends ScalaCliSuite
458458
}
459459

460460
test("directives in multiple files diagnostics") {
461-
val inputs = TestInputs(
461+
val javaVersion = Constants.allJavaVersions.filter(_ > Constants.defaultJvmVersion).min
462+
val inputs = TestInputs(
462463
os.rel / "Foo.scala" ->
463-
s"""//> using scala 3.3.0
464+
s"""//> using scala $actualScalaVersion
464465
|
465466
|object Foo extends App {
466467
| println("Foo")
467468
|}
468469
|""".stripMargin,
469470
os.rel / "Bar.scala" -> "",
470-
os.rel / "Hello.java" -> "//> using jvm 11"
471+
os.rel / "Hello.java" -> s"//> using jvm $javaVersion"
471472
)
472473

473474
withBsp(inputs, Seq(".")) { (root, localClient, remoteServer) =>
@@ -522,8 +523,20 @@ abstract class BspTestDefinitions extends ScalaCliSuite
522523
)
523524
}
524525

525-
checkDirectivesInMultipleFilesWarnings("Foo.scala", 0, 0, 0, 21)
526-
checkDirectivesInMultipleFilesWarnings("Hello.java", 0, 0, 0, 16)
526+
checkDirectivesInMultipleFilesWarnings(
527+
fileName = "Foo.scala",
528+
expectedStartLine = 0,
529+
expectedStartCharacter = 0,
530+
expectedEndLine = 0,
531+
expectedEndCharacter = 16 + actualScalaVersion.length
532+
)
533+
checkDirectivesInMultipleFilesWarnings(
534+
fileName = "Hello.java",
535+
expectedStartLine = 0,
536+
expectedStartCharacter = 0,
537+
expectedEndLine = 0,
538+
expectedEndCharacter = 16
539+
)
527540
}
528541
}
529542
}
@@ -2232,7 +2245,7 @@ abstract class BspTestDefinitions extends ScalaCliSuite
22322245
if actualScalaVersion.coursierVersion >= "3.5.0".coursierVersion
22332246
scalaVersion =
22342247
if actualScalaVersion == Constants.scala3NextRc then Constants.scala3NextRcAnnounced
2235-
if actualScalaVersion == Constants.scala3Next then Constants.scala3NextAnnounced
2248+
else if actualScalaVersion == Constants.scala3Next then Constants.scala3NextAnnounced
22362249
else actualScalaVersion
22372250
withLauncher = (root: os.Path) =>
22382251
(f: Seq[os.Shellable] => Unit) =>

modules/integration/src/test/scala/scala/cli/integration/CompileTestDefinitions.scala

Lines changed: 94 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -328,58 +328,95 @@ abstract class CompileTestDefinitions
328328
TestInputs(os.rel / "Main.scala" -> s"object Main{java.util.Optional.of(1).isPresent}")
329329
val scalaJvm11Project: TestInputs =
330330
TestInputs(os.rel / "Main.scala" -> s"object Main{java.util.Optional.of(1).isEmpty}")
331+
val scalaJvm17Project: TestInputs =
332+
TestInputs(os.rel / "Main.scala" -> s"object Main{java.util.HexFormat.of().toHexDigits(255)}")
333+
val scalaJvm23Project: TestInputs =
334+
TestInputs(
335+
os.rel / "Main.scala" -> s"object Main{System.out.println(javax.print.attribute.standard.OutputBin.LEFT)}"
336+
)
331337
val javaJvm8Project: TestInputs =
332338
TestInputs(os.rel / "Main.java" -> """|public class Main{
333339
| public static void main(String[] args) {
334340
| java.util.Optional.of(1).isPresent();
335341
| }
336342
|}""".stripMargin)
337-
338343
val javaJvm11Project: TestInputs =
339344
TestInputs(os.rel / "Main.java" -> """|public class Main{
340345
| public static void main(String[] args) {
341346
| java.util.Optional.of(1).isEmpty();
342347
| }
343348
|}""".stripMargin)
349+
val javaJvm17Project: TestInputs =
350+
TestInputs(os.rel / "Main.java" -> """|public class Main{
351+
| public static void main(String[] args) {
352+
| java.util.HexFormat.of().toHexDigits(255);
353+
| }
354+
|}""".stripMargin)
355+
val javaJvm23Project: TestInputs =
356+
TestInputs(os.rel / "Main.java" -> """|public class Main{
357+
| public static void main(String[] args) {
358+
| System.out.println(javax.print.attribute.standard.OutputBin.LEFT);
359+
| }
360+
|}""".stripMargin)
344361

345-
val inputs: Map[(String, Int), TestInputs] = Map(
346-
("scala", 8) -> scalaJvm8Project,
347-
("scala", 11) -> scalaJvm11Project,
348-
("java", 8) -> javaJvm8Project,
349-
("java", 11) -> javaJvm11Project
350-
)
362+
def inputs: Map[(String, Int), TestInputs] =
363+
if isScala38OrNewer
364+
then
365+
Map(
366+
("scala", 17) -> scalaJvm17Project,
367+
("scala", 23) -> scalaJvm23Project,
368+
("java", 17) -> javaJvm17Project,
369+
("java", 23) -> javaJvm23Project
370+
)
371+
else
372+
Map(
373+
("scala", 8) -> scalaJvm8Project,
374+
("scala", 11) -> scalaJvm11Project,
375+
("scala", 17) -> scalaJvm17Project,
376+
("scala", 23) -> scalaJvm23Project,
377+
("java", 8) -> javaJvm8Project,
378+
("java", 11) -> javaJvm11Project,
379+
("java", 17) -> javaJvm17Project,
380+
("java", 23) -> javaJvm23Project
381+
)
351382

352-
for {
353-
bloopJvm <- List(8, 11)
354-
targetJvm <- List(8, 11)
355-
((lang, sourcesJvm), project) <- inputs
356-
} test(s"JvmCompatibilityTest: bloopJvm:$bloopJvm/targetJvm:$targetJvm/lang:$lang/sourcesJvm:$sourcesJvm"
357-
.tag(jvmT)) {
358-
compileToADifferentJvmThanBloops(
359-
bloopJvm.toString,
360-
targetJvm.toString,
361-
targetJvm >= sourcesJvm,
362-
project
363-
)
383+
{
384+
val legacyJvms = List(8, 11)
385+
val currentJvms = List(17, 23)
386+
val jvms = if isScala38OrNewer then currentJvms else legacyJvms ++ currentJvms
387+
for {
388+
bloopJvm <- jvms
389+
targetJvm <- jvms
390+
((lang, sourcesJvm), project) <- inputs
391+
} test(s"JvmCompatibilityTest: bloopJvm:$bloopJvm/targetJvm:$targetJvm/lang:$lang/sourcesJvm:$sourcesJvm"
392+
.tag(jvmT)) {
393+
compileToADifferentJvmThanBloops(
394+
bloopJvm.toString,
395+
targetJvm.toString,
396+
targetJvm >= sourcesJvm,
397+
project
398+
)
399+
}
364400
}
365401

366402
test("Scala CLI should not infer scalac --release if --release is passed".tag(jvmT)) {
367-
scalaJvm11Project.fromRoot { root =>
403+
scalaJvm23Project.fromRoot { root =>
368404
val res = os.proc(
369405
TestUtil.cli,
370406
"compile",
371407
extraOptions,
372408
"--jvm",
373-
"11",
409+
"23",
374410
"-release",
375-
"8",
411+
"17",
376412
"."
377413
).call(cwd = root, check = false, stderr = os.Pipe)
378414
expect(res.exitCode != 0)
379415
val errOutput = res.err.trim()
380-
expect(errOutput.contains("isEmpty is not a member"))
416+
System.err.println(errOutput)
417+
expect(errOutput.contains("OutputBin is not a member"))
381418
expect(errOutput.contains(
382-
"Warning: different target JVM (11) and scala compiler target JVM (8) were passed."
419+
"Warning: different target JVM (23) and scala compiler target JVM (17) were passed."
383420
))
384421
}
385422
}
@@ -426,12 +463,13 @@ abstract class CompileTestDefinitions
426463
)
427464
val res = os.proc(TestUtil.cli, "compile", extraOptions, "--jvm", targetJvm, ".")
428465
.call(cwd = root, check = false, stderr = os.Pipe)
429-
expect((res.exitCode == 0) == shouldSucceed)
430-
if (!shouldSucceed)
466+
val succeeded = res.exitCode == 0
467+
if succeeded != shouldSucceed then System.err.println(res.err.text())
468+
expect(succeeded == shouldSucceed)
469+
if !shouldSucceed then
431470
expect(
432-
res.err.text().contains("value isEmpty is not a member") || res.err.text().contains(
433-
"cannot find symbol"
434-
)
471+
res.err.text().contains("is not a member") ||
472+
res.err.text().contains("cannot find symbol")
435473
)
436474
}
437475
if (actualScalaVersion.startsWith("2.12"))
@@ -743,7 +781,7 @@ abstract class CompileTestDefinitions
743781
val filename = "Main.scala"
744782
val inputs = TestInputs(
745783
os.rel / filename ->
746-
"""|object Main extends App {
784+
"""|object Main {
747785
| val msg: String = "1"
748786
|}
749787
|""".stripMargin
@@ -755,17 +793,16 @@ abstract class CompileTestDefinitions
755793
mergeErrIntoOut = true
756794
)
757795

758-
assertEquals(
759-
TestUtil.fullStableOutput(result),
760-
s"""|Compiling project (Scala $actualScalaVersion, JVM (${Constants
761-
.defaultGraalVMJavaVersion}))
762-
|Compiled project (Scala $actualScalaVersion, JVM (${Constants
763-
.defaultGraalVMJavaVersion}))""".stripMargin
764-
)
796+
val jvmVersion = Constants.defaultGraalVMJavaVersion
797+
val expectedOutput =
798+
s"""|Compiling project (Scala $actualScalaVersion, JVM ($jvmVersion))
799+
|Compiled project (Scala $actualScalaVersion, JVM ($jvmVersion))""".stripMargin
800+
val actualOutput = TestUtil.fullStableOutput(result)
801+
assertEquals(actualOutput, expectedOutput)
765802

766803
os.write.over(
767804
root / filename,
768-
"""|object Main extends App {
805+
"""|object Main {
769806
| val msg: String = 1
770807
|}
771808
|""".stripMargin
@@ -777,30 +814,29 @@ abstract class CompileTestDefinitions
777814
mergeErrIntoOut = true
778815
)
779816

780-
val expectedError = if (actualScalaVersion.startsWith("2"))
781-
"""|[error] type mismatch;
782-
|[error] found : Int(1)
783-
|[error] required: String""".stripMargin
784-
else
785-
"""|[error] Found: (1 : Int)
786-
|[error] Required: String""".stripMargin
817+
val expectedError =
818+
if actualScalaVersion.startsWith("2") then
819+
"""|[error] type mismatch;
820+
|[error] found : Int(1)
821+
|[error] required: String""".stripMargin
822+
else
823+
"""|[error] Found: (1 : Int)
824+
|[error] Required: String""".stripMargin
787825

788-
assertEquals(
789-
TestUtil.fullStableOutput(result2).trim,
790-
s"""|Compiling project (Scala $actualScalaVersion, JVM (${Constants
791-
.defaultGraalVMJavaVersion}))
826+
val actualOutput2 = TestUtil.fullStableOutput(result2).trim
827+
val expectedOutput2 =
828+
s"""|Compiling project (Scala $actualScalaVersion, JVM ($jvmVersion))
792829
|[error] .${File.separatorChar}Main.scala:2:23
793830
|$expectedError
794831
|[error] val msg: String = 1
795832
|[error] ^
796-
|Error compiling project (Scala $actualScalaVersion, JVM (${Constants
797-
.defaultGraalVMJavaVersion}))
833+
|Error compiling project (Scala $actualScalaVersion, JVM ($jvmVersion))
798834
|Compilation failed""".stripMargin
799-
)
835+
assertEquals(actualOutput2, expectedOutput2)
800836

801837
os.write.over(
802838
root / filename,
803-
"""|object Main extends App {
839+
"""|object Main {
804840
| val msg: String = "1"
805841
|}
806842
|""".stripMargin
@@ -812,14 +848,11 @@ abstract class CompileTestDefinitions
812848
mergeErrIntoOut = true
813849
)
814850

815-
assertEquals(
816-
TestUtil.fullStableOutput(result3),
817-
s"""|Compiling project (Scala $actualScalaVersion, JVM (${Constants
818-
.defaultGraalVMJavaVersion}))
819-
|Compiled project (Scala $actualScalaVersion, JVM (${Constants
820-
.defaultGraalVMJavaVersion}))""".stripMargin
821-
)
822-
851+
val actualOutput3 = TestUtil.fullStableOutput(result3)
852+
val expectedOutput3 =
853+
s"""|Compiling project (Scala $actualScalaVersion, JVM ($jvmVersion))
854+
|Compiled project (Scala $actualScalaVersion, JVM ($jvmVersion))""".stripMargin
855+
assertEquals(actualOutput3, expectedOutput3)
823856
}
824857
}
825858

0 commit comments

Comments
 (0)