Skip to content

Commit cb1f197

Browse files
committed
Extend test cases
1 parent ada60b0 commit cb1f197

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

tests/neg-custom-args/captures/mutability.check

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
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

tests/neg-custom-args/captures/mutability.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,12 @@ class Ref2[T](init: T) extends caps.Mutable:
1818
def 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+

0 commit comments

Comments
 (0)