Skip to content

Commit cdd3d1e

Browse files
committed
Fix the compiler message in a code example in docs
1 parent 5b6659d commit cdd3d1e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The checker will report:
2929

3030
``` scala
3131
-- Warning: tests/init/neg/AbstractFile.scala:7:4 ------------------------------
32-
7 | val localFile: String = url.hashCode + ".tmp" // error
32+
7 | val localFile: String = s"${url.##}.tmp" // error: usage of `localFile` before it's initialized
3333
| ^
3434
| Access non-initialized field value localFile. Calling trace:
3535
| -> val extension: String = name.substring(4) [ AbstractFile.scala:3 ]
@@ -183,7 +183,6 @@ are transitively initialized, so is the result.
183183

184184
With the established principles and design goals, following rules are imposed:
185185

186-
187186
1. In an assignment `o.x = e`, the expression `e` may only point to transitively initialized objects.
188187

189188
This is how monotonicity is enforced in the system. Note that in an

0 commit comments

Comments
 (0)