Skip to content

Commit eeee3df

Browse files
committed
add failing test when inline method calls forwarder
1 parent a6b757c commit eeee3df

File tree

7 files changed

+85
-0
lines changed

7 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package a
2+
3+
import scala.annotation.unroll
4+
5+
object A {
6+
7+
def foo(s: String, x: Int, @unroll b: Boolean = true): String = s + x + b
8+
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package a
2+
3+
import scala.annotation.unroll
4+
5+
object A {
6+
7+
def foo(s: String, x: Int): String = s + x
8+
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package b
2+
3+
import a.*
4+
5+
object B {
6+
transparent inline def caller = A.foo("abc", 2)
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
lazy val commonSettings = Seq(
2+
scalacOptions += "-experimental",
3+
)
4+
5+
lazy val printSettings = Seq(
6+
scalacOptions += "-Yprint-tasty",
7+
)
8+
9+
lazy val a = project.in(file("a"))
10+
.settings(commonSettings)
11+
.settings(
12+
Compile / classDirectory := (ThisBuild / baseDirectory).value / "b-input"
13+
)
14+
15+
lazy val b = project.in(file("b"))
16+
.settings(commonSettings)
17+
.settings(
18+
Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "b-input",
19+
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-input"
20+
)
21+
22+
lazy val `a-changes` = project.in(file("a-changes"))
23+
.settings(commonSettings)
24+
.settings(
25+
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-input"
26+
)
27+
28+
lazy val c = project.in(file("c"))
29+
.settings(commonSettings)
30+
.settings(printSettings)
31+
.settings(
32+
// scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Xfatal-warnings", "-Xprint:readTasty", "-Xprint-types"),
33+
// Compile / sources := Seq(new java.io.File("c-input/B.tasty")),
34+
Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "c-input",
35+
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-output"
36+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import b.*
2+
3+
object C {
4+
val res = B.caller
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import sbt._
2+
import Keys._
3+
4+
object DottyInjectedPlugin extends AutoPlugin {
5+
override def requires = plugins.JvmPlugin
6+
override def trigger = allRequirements
7+
8+
override val projectSettings = Seq(
9+
scalaVersion := sys.props("plugin.scalaVersion")
10+
)
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# compile library A
2+
> a/compile
3+
# compile library B, from source, against A
4+
> b/compile
5+
# add a new parameter in method to library A', using @unroll to generate a forwarder
6+
> a-changes/compile
7+
# compile B, from tasty, against A', it should still compile: the generated forwarder is resolved.
8+
> c/compile

0 commit comments

Comments
 (0)