File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 3232 |
3333 | where: ^ refers to a fresh root capability classified as Mutable in the type of value x
3434-- Error: tests/neg-custom-args/captures/mutability.scala:22:5 ---------------------------------------------------------
35- 22 | r2 .set(33) // error
35+ 22 | r1 .set(33) // error
3636 | ^^^^^^
37- | cannot call update method set from (r2 : Ref[Int]),
38- | since its capture set {r2} is read-only
37+ | cannot call update method set from (r1 : Ref[Int]),
38+ | since its capture set {r1} is read-only
39+ -- Error: tests/neg-custom-args/captures/mutability.scala:27:7 ---------------------------------------------------------
40+ 27 | r3.x.set(33) // error
41+ | ^^^^^^^^
42+ | cannot call update method set from (r3.x : Ref[Int]^),
43+ | since the capture set {r3} of its prefix (r3 : Ref2[Int]) is read-only
44+ |
45+ | where: ^ refers to a fresh root capability classified as Mutable in the type of value x
Original file line number Diff line number Diff line change @@ -18,5 +18,12 @@ class Ref2[T](init: T) extends caps.Mutable:
1818def test =
1919 val r = Ref (22 )
2020 r.set(33 ) // ok
21- val r2 : Ref [Int ] = Ref (22 )
22- r2.set(33 ) // error
21+ val r1 : Ref [Int ] = Ref (22 )
22+ r1.set(33 ) // error
23+
24+ val r2 = Ref2 (22 )
25+ r2.x.set(33 ) // ok
26+ val r3 : Ref2 [Int ] = Ref2 (22 )
27+ r3.x.set(33 ) // error
28+
29+
You can’t perform that action at this time.
0 commit comments