Skip to content

Spec claims access modifier implies val #12562

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

Closed
som-snytt opened this issue Mar 21, 2022 · 2 comments
Closed

Spec claims access modifier implies val #12562

som-snytt opened this issue Mar 21, 2022 · 2 comments

Comments

@som-snytt
Copy link

som-snytt commented Mar 21, 2022

Reproduction steps

Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 17.0.2).
Type in expressions for evaluation. Or try :help.

scala> class C(i: Int)
class C

scala> new C(42).i
                 ^
       error: value i is not a member of C

scala> object X { class C(private[X] i: Int) ; def x = new C(42).i }
                                                                 ^
       error: value i is not a member of X.C

scala> object X { class C(private[X] val i: Int) ; def x = new C(42).i }
object X

Problem

Spec claims

When access modifiers are given for a parameter, but no val or var keyword, val is assumed.

This came up recently on a forum or ticket, and I was confused by it again when looking at trait parameters on Scala 3.

Scala 3 gives the same result, so I assume the spec is wrong. Or maybe the spec is right and no one knows it.

@SethTisue
Copy link
Member

SethTisue commented Apr 19, 2022

(Let's see what happens over in Scala 3 (at scala/scala3#14735) before potentially making any changes to Scala 2.)

@som-snytt
Copy link
Author

out of scope

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2025
@SethTisue SethTisue removed this from the Backlog milestone Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants