Scalatest 3.2.9 (Scala 3.0.0)
Scastie: https://scastie.scala-lang.org/bS9fESLzT6OPvUFDKblNDw
import org.scalatest.funsuite.AnyFunSuite
class Tests extends AnyFunSuite {
test("foo") {
case class Pair[X, Y](
x: X,
y: Y,
)
}
}
results in this error when compiling
bad parameter reference Pair.this.X at inlining
the parameter is type X in class Pair but the prefix (Pair.this : Pair[X, Y])
does not define any corresponding arguments.
idx = 0, args = List()
It used to compile fine with Scalatest 3.2.8 (Scala 3.0.0-RC3).
@TomasMikula I took a look at this, and the problem can be minimized to this without ScalaTest:
class TestSuite {
inline def test(fun: => Any): Any = fun
test {
case class Pair[X, Y](
x: X,
y: Y,
)
()
}
}
I have created an example project here:
https://github.com/cheeseng/scala3-case-class-inline-problem
I'll try to reach the dotty gitter and see if we can find a cause, for now the workaround may be is to move the case class declaration out of the test block.
@TomasMikula Fyi I submitted a ticket here: https://github.com/lampepfl/dotty/issues/12508
Great, thank you!
Most helpful comment
@TomasMikula I took a look at this, and the problem can be minimized to this without ScalaTest:
I have created an example project here:
https://github.com/cheeseng/scala3-case-class-inline-problem
I'll try to reach the dotty gitter and see if we can find a cause, for now the workaround may be is to move the case class declaration out of the test block.