Skip to content

Unable to get surface of a class with protected members in Scala 3 #3356

@OndrejSpanel

Description

@OndrejSpanel

Following code works fine with Scala 2 but fails with Scala 3:

  case class C(protected val id: Int)

  Surface.of[C]

The error is:

value id cannot be accessed as a member of (x : Main.C) from module class Main$.
Access to protected value id not permitted because enclosing object Main
is not a subclass of class C in object Main where target is defined

Note: the same works fine with private val.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions