You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜ snips cat private.scala
classC {
privatedeff=42
}
➜ snips ~/projects/dotty/bin/scalac -Wunused:privates -d /tmp private.scala
--Warning:private.scala:3:14-----------------------------------------------------------------------------------------3|privatedeff=42|^| unused private member
1 warning found
➜ snips ~/projects/dotty/bin/scala -Wunused:privates
Welcome to Scala3.3.1-RC1-bin-SNAPSHOT-git-8c616bf (19, JavaOpenJDK64-BitServerVM).
Type in expressions for evaluation. Ortry:help.
scala>classC {
|privatedeff=42| }
// defined class C
Output
As shown.
Expectation
Expect warning in scala REPL as for same code in scalac.
➜ dotty git:(test/repl-unused) ./bin/scala -Wunused:all
Welcome to Scala 3.4.0-RC1-bin-SNAPSHOT-git-c90ad6b (20.0.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> class C { private def f = 42 }
1 warning found
-- Warning: ------------------------------------------------------------------------------------------------------------
1 |class C { private def f = 42 }
| ^
| unused private member
// defined class C
scala>
Same result with -Wunused:privates, just to be paranoid.
Also
scala> class C:
| private def f = 42
| end C
1 warning found
// defined class C
-- Warning: ------------------------------------------------------------------------------------------------------------
2 | private def f = 42
| ^
| unused private member
scala>
Compiler version
3.3.1-RC1-bin-SNAPSHOT-git-8c616bf
Minimized code
Output
As shown.
Expectation
Expect warning in scala REPL as for same code in scalac.
Noticed at #16823 (comment)
The text was updated successfully, but these errors were encountered: