Skip to content

Commit 5d0eea3

Browse files
authored
Merge pull request #9622 from ShapelessCat/fix-typo
Fix a typo in the comment of a code example in docs
2 parents fffb012 + a1da198 commit 5d0eea3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/docs/reference/other-new-features/safe-initialization.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ To get a feel of how it works, we first show several examples below.
1313

1414
Given the following code snippet:
1515

16-
``` Scala
16+
``` scala
1717
abstract class AbstractFile {
1818
def name: String
1919
val extension: String = name.substring(4)
2020
}
2121

2222
class RemoteFile(url: String) extends AbstractFile {
23-
val localFile: String = url.hashCode + ".tmp" // error: usge of `localFile` before it's initialized
23+
val localFile: String = s"${url.##}.tmp" // error: usage of `localFile` before it's initialized
2424
def name: String = localFile
2525
}
2626
```
@@ -227,14 +227,14 @@ and avoids accidental violation of contracts across library versions.
227227

228228
We impose the following rules to enforce modularity:
229229

230-
4. A class or trait that may be extended in another project should not
230+
1. A class or trait that may be extended in another project should not
231231
call virtual methods on `this` in its template/mixin evaluation,
232232
directly or indirectly.
233233

234-
5. The method call `o.m(args)` is forbidden if `o` is not transitively
234+
2. The method call `o.m(args)` is forbidden if `o` is not transitively
235235
initialized and the target of `m` is defined in an external project.
236236

237-
6. The expression `new p.C(args)` is forbidden, if `p` is not transitively
237+
3. The expression `new p.C(args)` is forbidden, if `p` is not transitively
238238
initialized and `C` is defined in an external project.
239239

240240
Theoretically, we may analyze across project boundaries based on tasty. However,
@@ -262,7 +262,7 @@ Potentials (π) represent values that are possibly under initialization.
262262
- `π.super[D]`: essentially the object π, used for virtual method resolution
263263
- `Cold`: an object with unknown initialization status
264264
- `Fun(Π, Φ)`: a function, when called produce effects Φ and return potentials Π.
265-
- `Outer(C, π)`: the potential of `this` for the enclosing class of `C` when `C.this` is ` π`.
265+
- `Outer(C, π)`: the potential of `this` for the enclosing class of `C` when `C.this` is `π`.
266266

267267
Effects are triggered from potentials:
268268

0 commit comments

Comments
 (0)