Skip to content

Commit dff7d88

Browse files
committed
Fix inline example with missing getter method
1 parent 9e8f0fe commit dff7d88

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/docs/reference/metaprogramming/inline.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,20 @@ In the `true` case the code will be rewritten to:
7979
def factorial(n: BigInt): BigInt = {
8080
val msg = s"factorial($n)"
8181
println(s"${" " * indent}start $msg")
82-
Logger.inline$indent += indentSetting
82+
Logger.inline$indent_=(indent.+(indentSetting))
8383
val result =
8484
if (n == 0) 1
8585
else n * factorial(n - 1)
86-
Logger.inline$indent -= indentSetting
86+
Logger.inline$indent_=(indent.-(indentSetting))
8787
println(s"${" " * indent}$msg = $result")
8888
result
8989
}
9090
```
9191

9292
Note, that the by-value parameter is evaluated only once, per the usual Scala
9393
semantics, by binding the value and reusing the `msg` through the body of
94-
`factorial`.
94+
`factorial`. Also, note the special handling of setting to the private var
95+
`indent` by generating the setter method `def inline$indent_=`.
9596

9697
### Recursive Inline Methods
9798

0 commit comments

Comments
 (0)