Closed
Description
Compiler version
Scala Version: 3.0.0 - 3.0.2
SBT: 1.5.2, 1.5.5
Example project here: https://github.com/cheeseng/scala3-case-class-inline-problem
Minimized code
class Test {
inline def test(fun: => Any): Any = fun
test {
case class Pair[X, Y](
x: X,
y: Y,
)
}
}
Output
cheeseng@cheeseng-RAVEN:~/git/scala3-case-class-inline-problem$ sbt clean compile
[info] welcome to sbt 1.5.2 (GraalVM Community Java 1.8.0_292)
[info] loading project definition from /home/cheeseng/git/scala3-case-class-inline-problem/project
[info] loading settings for project root from build.sbt ...
[info] set current project to scala3-simple (in build file:/home/cheeseng/git/scala3-case-class-inline-problem/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed May 18, 2021 10:31:40 AM
[info] compiling 1 Scala source to /home/cheeseng/git/scala3-case-class-inline-problem/target/scala-3.0.0/classes ...
[error] -- Error: /home/cheeseng/git/scala3-case-class-inline-problem/src/main/scala/Test.scala:3:2
[error] 3 | inline def test(fun: => Any): Any = fun
[error] | ^
[error] |bad parameter reference Pair.this.X at inlining
[error] |the parameter is type X in class Pair but the prefix (Pair.this : Pair[X, Y])
[error] |does not define any corresponding arguments.
[error] |idx = 0, args = List()
[error] 4 | test {
[error] 5 | case class Pair[X, Y](
[error] 6 | x: X,
[error] 7 | y: Y,
[error] 8 | )
[error] 9 | }
[error] one error found
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 3 s, completed May 18, 2021 10:31:43 AM
Expectation
The code should compile without error.