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
Copy file name to clipboardExpand all lines: docs/_docs/reference/experimental/capture-checking/mutability.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -217,7 +217,7 @@ val b2: Ref^{cap.rd} = a
217
217
218
218
## Lazy Vals and Read-Only Restrictions
219
219
220
-
Lazy val initializers are subject to read-only restrictions similar to those for normal methods in `Mutable` classes. Specifically, a lazy val initializer cannot call update methods on non-local exclusive capabilities—capabilities defined outside the lazy val's scope.
220
+
Lazy val initializers in `Mutable` classes are subject to read-only restrictions similar to those for normal methods. Specifically, a lazy val initializer in a `Mutable` class cannot call update methods or refer to non-local exclusive capabilities—capabilities defined outside the lazy val's scope.
| Cannot call update method set of TestClass.this.r
25
+
| since the access is in lazy value lazyVal8, which is not an update method.
26
+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyvals-sep.scala:72:12 ---------------------------------
27
+
72 | Wrapper(r) // error
28
+
| ^
29
+
|Found: Ref^{TestClass.this.r.rd}
30
+
|Required: Ref^
31
+
|
32
+
|Note that capability TestClass.this.r.rd is not included in capture set {}.
33
+
|
34
+
|Note that {cap} is an exclusive capture set of the mutable type Ref^,
35
+
|it cannot subsume a read-only capture set of the mutable type Ref^{TestClass.this.r.rd}.
36
+
|
37
+
|where: ^ and cap refer to a fresh root capability classified as Mutable created in lazy value lazyVal8 when checking argument to parameter ref of constructor Wrapper
38
+
|
39
+
| longer explanation available when compiling with `-explain`
40
+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyvals-sep.scala:77:12 ---------------------------------
41
+
77 | Wrapper(r) // error
42
+
| ^
43
+
|Found: Ref^{TestClass.this.r.rd}
44
+
|Required: Ref^
45
+
|
46
+
|Note that capability TestClass.this.r.rd is not included in capture set {}.
47
+
|
48
+
|Note that {cap} is an exclusive capture set of the mutable type Ref^,
49
+
|it cannot subsume a read-only capture set of the mutable type Ref^{TestClass.this.r.rd}.
50
+
|
51
+
|where: ^ and cap refer to a fresh root capability classified as Mutable created in lazy value lazyVal9 when checking argument to parameter ref of constructor Wrapper
52
+
|
53
+
| longer explanation available when compiling with `-explain`
0 commit comments