File tree 2 files changed +16
-0
lines changed
docs/_docs/reference/dropped-features
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
29
29
// [C] needed if `field` is to be accessed through reflection
30
30
val retained = field * field
31
31
```
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