Skip to content

inline methods can leak references to private classes #8194

Open
@LPTK

Description

@LPTK

minimized code

object Test {
  private class A() { def test = 42 }
  inline def foo: Int = A().test
}
@main def main = Test.foo

https://scastie.scala-lang.org/or0Eg6u9Tky1ImaUNEdOug

Compilation output

class A in object Test cannot be accessed as a member of (Test : Test.type) from module class main$package$.

expectation

This should compile, or at least report an error at the definition site of the inline method (similarly to how errors are reported when classes leak private val references), not at call sites.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions