Skip to content

Commit

Permalink
add failing test when inline method calls forwarder
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Oct 7, 2024
1 parent a6b757c commit eeee3df
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/a-changes/A.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package a

import scala.annotation.unroll

object A {

def foo(s: String, x: Int, @unroll b: Boolean = true): String = s + x + b

}
9 changes: 9 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/a/A.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package a

import scala.annotation.unroll

object A {

def foo(s: String, x: Int): String = s + x

}
7 changes: 7 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/b/B.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package b

import a.*

object B {
transparent inline def caller = A.foo("abc", 2)
}
36 changes: 36 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
lazy val commonSettings = Seq(
scalacOptions += "-experimental",
)

lazy val printSettings = Seq(
scalacOptions += "-Yprint-tasty",
)

lazy val a = project.in(file("a"))
.settings(commonSettings)
.settings(
Compile / classDirectory := (ThisBuild / baseDirectory).value / "b-input"
)

lazy val b = project.in(file("b"))
.settings(commonSettings)
.settings(
Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "b-input",
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-input"
)

lazy val `a-changes` = project.in(file("a-changes"))
.settings(commonSettings)
.settings(
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-input"
)

lazy val c = project.in(file("c"))
.settings(commonSettings)
.settings(printSettings)
.settings(
// scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Xfatal-warnings", "-Xprint:readTasty", "-Xprint-types"),
// Compile / sources := Seq(new java.io.File("c-input/B.tasty")),
Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "c-input",
Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-output"
)
5 changes: 5 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/c/C.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import b.*

object C {
val res = B.caller
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sbt._
import Keys._

object DottyInjectedPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin
override def trigger = allRequirements

override val projectSettings = Seq(
scalaVersion := sys.props("plugin.scalaVersion")
)
}
8 changes: 8 additions & 0 deletions sbt-test/tasty-compat/add-param-unroll/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# compile library A
> a/compile
# compile library B, from source, against A
> b/compile
# add a new parameter in method to library A', using @unroll to generate a forwarder
> a-changes/compile
# compile B, from tasty, against A', it should still compile: the generated forwarder is resolved.
> c/compile

0 comments on commit eeee3df

Please sign in to comment.