Skip to content

Commit caa6c84

Browse files
Merge pull request #7865 from ShapelessCat/master
Update a link and correct a piece of example code for inline.md
2 parents 5968d41 + 71c2e0d commit caa6c84

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/docs/reference/metaprogramming/inline.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object Logger {
3333
The `Config` object contains a definition of the **inline value** `logging`.
3434
This means that `logging` is treated as a _constant value_, equivalent to its
3535
right-hand side `false`. The right-hand side of such an `inline val` must itself
36-
be a [constant expression](https://scala-lang.org/files/archive/spec/2.12/06-expressions.html#constant-expressions).
36+
be a [constant expression](https://scala-lang.org/files/archive/spec/2.13/06-expressions.html#constant-expressions).
3737
Used in this way, `inline` is equivalent to Java and Scala 2's `final`. Note that `final`, meaning
3838
_inlined constant_, is still supported in Dotty, but will be phased out.
3939

@@ -108,16 +108,16 @@ inline def power(x: Double, n: Int): Double = {
108108
val y = power(x, n / 2)
109109
if (n % 2 == 0) y * y else y * y * x
110110
}
111-
112-
power(expr, 10)
113-
// translates to
114-
//
115-
// val x = expr
116-
// val y1 = x * x // ^2
117-
// val y2 = y1 * y1 // ^4
118-
// val y3 = y2 * x // ^5
119-
// y3 * y3 // ^10
120111
}
112+
113+
power(expr, 10)
114+
// translates to
115+
//
116+
// val x = expr
117+
// val y1 = x * x // ^2
118+
// val y2 = y1 * y1 // ^4
119+
// val y3 = y2 * x // ^5
120+
// y3 * y3 // ^10
121121
```
122122

123123
Parameters of inline methods can have an `inline` modifier as well. This means

0 commit comments

Comments
 (0)