Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
OndrejSpanel opened this issue Jan 29, 2024 · 0 comments · Fixed by #3407
Closed

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

OndrejSpanel opened this issue Jan 29, 2024 · 0 comments · Fixed by #3407
Labels

Comments

@OndrejSpanel
Copy link
Contributor

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.

@xerial xerial added the bug label Jan 30, 2024
xerial added a commit that referenced this issue Feb 25, 2024
…elds (#3407)

- **surface (fix): Fixes #3356 for case classes with private/protected
parameters**
- **Fix for Scala 2**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants