File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
docs/_docs/reference/dropped-features Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,15 @@ This can cause problems if a program tries to access the missing private field v
2929 // [C] needed if `field` is to be accessed through reflection
3030 val retained = field * field
3131```
32+
33+ Class parameters are normally inferred object-private,
34+ so that members introduced by explicitly declaring them ` val ` or ` var ` are exempt from the rule described here.
35+
36+ In particular, the following field is not excluded from variance checking:
37+ ``` scala
38+ class C [- T ](private val t : T ) // error
39+ ```
40+ And in contrast to the private field shown above, this field is not eliminated:
41+ ``` scala
42+ class C (private val c : Int )
43+ ```
Original file line number Diff line number Diff line change 1+
2+ import scala .collection .mutable .ArrayBuffer
3+
4+ class PrivateTest [- M ](private val v : ArrayBuffer [M ]) // error
You can’t perform that action at this time.
0 commit comments