Skip to content

Commit f53d714

Browse files
committed
Part 9 - fix CodeGen integration tests for Scala 3
- update com-lihaoyi/sourcecode to use new macro implementation - fix callgraph 4-actors test: account for private[this] inferrence - fix - callgraph 8-linked-list-scala test: account for new override semantics - fix 5-parser codesig test to account for new expansion - use custom SAM type in lambda tests for scala (specialisation dropped in scala 3) - tweak CodeSig ignoreCall logic to account for Scala 3 lambdas - update some dependencies so invalidation tests actually run - fix indentation in codesig tests
1 parent e36c41e commit f53d714

File tree

14 files changed

+116
-300
lines changed

14 files changed

+116
-300
lines changed

build.mill

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ object Deps {
177177
val scalacScoverage2Serializer =
178178
ivy"org.scoverage::scalac-scoverage-serializer:${scoverage2Version}"
179179
val scalaparse = ivy"com.lihaoyi::scalaparse:${fastparse.version}"
180-
val scalatags = ivy"com.lihaoyi::scalatags:0.12.0"
180+
val scalatags = ivy"com.lihaoyi::scalatags:0.12.0".withDottyCompat(scalaVersion)
181181
def scalaXml = ivy"org.scala-lang.modules::scala-xml:2.3.0"
182182
// keep in sync with doc/antora/antory.yml
183183
val semanticDBscala = ivy"org.scalameta:::semanticdb-scalac:4.9.9"
184184
val semanticDbJava = ivy"com.sourcegraph:semanticdb-java:0.10.3"
185-
val sourcecode = ivy"com.lihaoyi::sourcecode:0.3.1"
185+
val sourcecode = ivy"com.lihaoyi::sourcecode:0.4.3-M1"
186186
val upickle = ivy"com.lihaoyi::upickle:3.3.1"
187187
val windowsAnsi = ivy"io.github.alexarchambault.windows-ansi:windows-ansi:0.0.5"
188188
val zinc = ivy"org.scala-sbt::zinc:1.10.2".withDottyCompat(scalaVersion)

integration/invalidation/codesig-hello/src/CodeSigHelloTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ object CodeSigHelloTests extends UtestIntegrationTestSuite {
2121
modifyFile(workspacePath / "build.mill", _.replace("running foo", "running foo2"))
2222
val mangledFoo = eval("foo")
2323

24-
assert(mangledFoo.out.linesIterator.toSeq == Seq("running foo2", "running helperFoo"))
24+
val out1 = mangledFoo.out.linesIterator.toSeq
25+
assert(out1 == Seq("running foo2", "running helperFoo"))
2526

2627
val cached2 = eval("foo")
2728
assert(cached2.out == "")

integration/invalidation/codesig-scalamodule/src/CodeSigScalaModuleTests.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,18 @@ object CodeSigScalaModuleTests extends UtestIntegrationTestSuite {
101101
)
102102

103103
// Adding newlines in various places doesn't invalidate anything
104+
// (preserving the indentation to avoid warnings in Scala 3).
104105
modifyFile(
105106
workspacePath / "build.mill",
106107
s =>
107108
"\n\n\n" +
108-
s.replace("def scalaVersion", "\ndef scalaVersion\n")
109-
.replace("def sources", "\ndef sources\n")
110-
.replace("def compile", "\ndef compile\n")
111-
.replace("def run", "\ndef run\n")
109+
s.replace("\n def scalaVersion", "\n\n def scalaVersion")
110+
.replace("\n def sources = T{\n", "\n\n def sources = T{\n\n")
111+
.replace("\n def compile = T {\n", "\n\n def compile = T {\n\n")
112+
.replace(
113+
"\n def run(args: Task[Args] = T.task(Args())) = T.command {\n",
114+
"\n\n def run(args: Task[Args] = T.task(Args())) = T.command {\n\n"
115+
)
112116
)
113117
val mangledFoo6 = eval("foo.run")
114118
assert(

integration/invalidation/invalidation/resources/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package build
22
import mill._
33
import $packages._
4-
import $ivy.`org.scalaj::scalaj-http:2.4.2`
4+
import $ivy.`org.scalaj:scalaj-http_2.13:2.4.2`
55

66
def task = Task {
77
build.a.input()

integration/invalidation/multi-level-editing/resources/mill-build/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import $meta._
33
import mill._, scalalib._
44

55
object `package` extends MillBuildRootModule {
6-
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags:${constant.MetaConstant.scalatagsVersion}")
6+
def ivyDeps = Agg(ivy"com.lihaoyi:scalatags_2.13:${constant.MetaConstant.scalatagsVersion}")
77

88
def generatedSources = Task {
99
os.write(

main/codesig/test/cases/callgraph/basic/17-scala-lambda/src/Hello.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package hello
22

33
object Hello {
4+
5+
trait MyFunction0[T] {
6+
def apply(): T
7+
}
8+
49
def main(): Int = {
510

6-
val foo = () => used()
11+
val foo: MyFunction0[Int] = () => used()
712
foo()
813
}
914
def used(): Int = 2

0 commit comments

Comments
 (0)