Skip to content

Commit 99925fe

Browse files
committed
Address review comments
1 parent e9e3777 commit 99925fe

File tree

1 file changed

+3
-1
lines changed
  • docs/_docs/reference/experimental/capture-checking

1 file changed

+3
-1
lines changed

docs/_docs/reference/experimental/capture-checking/classes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ we know that the type of `this` must be pure, since `this` is the right hand sid
7777

7878
### Traits and Open Classes
7979

80-
The self-type inference behaves differently depending on whether all subclasses of a class are known. For a regular (non-open, non-abstract) class, all subclasses are known at compile time, so the capture checker can precisely infer the self-type. However, for traits, abstract classes, and [`open`](../../other-new-features/open-classes.md) classes, arbitrary subclasses may exist, so the capture checker conservatively assumes that `this` may capture arbitrary capabilities
80+
The self-type inference behaves differently depending on whether all subclasses of a class are known. For a regular (non-open, non-abstract) class, all subclasses are known at compile time,¹ so the capture checker can precisely infer the self-type. However, for traits, abstract classes, and [`open`](../../other-new-features/open-classes.md) classes, arbitrary subclasses may exist, so the capture checker conservatively assumes that `this` may capture arbitrary capabilities
8181
(i.e., it infers the universal capture set `cap`).
8282

83+
¹We ignore here the possibility that non-open classes have subclasses in other compilation units (e.g. for testing) and assume that these subclasses do not change the inferred self type.
84+
8385
For example (assuming all definitions are in the same file):
8486
```scala
8587
class A:

0 commit comments

Comments
 (0)