Closed
Description
Compiler version
3.2.1
Minimized code
//> using scala "3.2.1"
class Context {
def normalMethod(): String = "normal"
inline def inlineMethod(): String = "inline"
}
class Script(ctx: Context) {
export ctx.*
normalMethod() // works
inlineMethod() // works
}
class MyScript(context: Context) extends Script(context) {
normalMethod() // works
inlineMethod() // error
}
Output
Compiling project (Scala 3.2.1, JVM)
[error] ./scala/inline-export-inherit.sc:16:3: ctx cannot be accessed as a member of (Script_this : (MyScript.this : inline-export-inherit.MyScript)) from class MyScript.
[error] inlineMethod() // error
[error] ^^^^^^^^^^^^^^
Expectation
It should compile unless the restriction is intentional. In that case, the reason should be mentioned in the docs.
Making ctx
a val
in Script
constructor makes it compile.