Skip to content

Commit

Permalink
Update Scala to 3.4.2 (#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault authored Jun 19, 2024
1 parent 575ed93 commit acbdbb8
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
matrix:
OS: [ubuntu-latest]
JDK: [8]
SCALA: [2.12.18, 2.12.19, 2.13.13, 2.13.14, 3.3.3]
SCALA: [2.12.18, 2.12.19, 2.13.13, 2.13.14, 3.3.3, 3.4.2]
include:
- OS: windows-latest
JDK: 8
Expand Down
16 changes: 16 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ trait ScalaInterpreter extends Cross.Module[String] with AlmondModule with Bloop
else Nil
scala213Options
}
def sources = T.sources {
super.sources() ++ CrossSources.extraSourcesDirs(scalaVersion(), millSourcePath)
}
object test extends CrossSbtModuleTests with AlmondTestModule {
def moduleDeps = {
val rx =
Expand Down Expand Up @@ -857,3 +860,16 @@ object dummy extends Module {
)
}
}

object CrossSources {
def extraSourcesDirs(sv: String, millSourcePath: os.Path): Seq[PathRef] = {
val (maj, min) = sv.split('.') match {
case Array(maj0, min0, _*) if min0.nonEmpty && min0.forall(_.isDigit) =>
(maj0, min0.toInt)
case _ =>
sys.error(s"Malformed Scala version: $sv")
}
val baseDir = millSourcePath / "src" / "main"
(0 to min).map(min0 => PathRef(baseDir / s"scala-$maj.$min0+"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package almond.internals

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.util.SourceFile

object Helper {
def nonSuspendableCompilationUnit(source: SourceFile): CompilationUnit =
new CompilationUnit(source):
override def isSuspendable: Boolean = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package almond.internals

import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.util.SourceFile

object Helper {
def nonSuspendableCompilationUnit(source: SourceFile): CompilationUnit =
new CompilationUnit(source, null):
override def isSuspendable: Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ object ScalaInterpreterCompletions {
)
implicit val ctx: Context = run.runContext.withSource(sourceFile)

val unit =
new CompilationUnit(ctx.source):
override def isSuspendable: Boolean = false
val unit = Helper.nonSuspendableCompilationUnit(ctx.source)
ctx
.run
.compileUnits(unit :: Nil, ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,21 @@ object Tests {
| ^
|No warnings can be incurred under -Xfatal-warnings.
|Compilation Failed""".stripMargin
else
else if ((0 to 3).exists(min => scalaVersion.startsWith(s"3.$min.")))
// FIXME The line number is wrong here
"""-- Error: cmd2.sc:3:8 ----------------------------------------------------------
|3 |val n = getValue()
| | ^^^^^^^^
| | method getValue in class Helper is deprecated since 0.1: foo
|Compilation Failed""".stripMargin
else
// FIXME The line number is wrong here
"""-- Warning: cmd2.sc:3:8 --------------------------------------------------------
|3 |val n = getValue()
| | ^^^^^^^^
| | method getValue in class Helper is deprecated since 0.1: foo
|No warnings can be incurred under -Werror (or -Xfatal-warnings)
|Compilation Failed""".stripMargin

execute(
"""//> using option "-Xfatal-warnings" "-deprecation"
Expand Down
3 changes: 2 additions & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ object Deps {
}

object ScalaVersions {
def scala3Latest = "3.3.3"
def scala3Latest = "3.4.2"
def scala3Compat = "3.3.0"
def scala213 = "2.13.14"
def scala212 = "2.12.19"
val binaries = Seq(scala3Compat, scala213, scala212)
val scala2Binaries = Seq(scala213, scala212)
val all = Seq(
scala3Latest,
"3.3.3",
"3.3.2",
"3.3.1",
scala3Compat,
Expand Down

0 comments on commit acbdbb8

Please sign in to comment.