Skip to content

Commit 3d67ac6

Browse files
authored
doc(inline): fix listing in override section
1 parent 6f51dbb commit 3d67ac6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

docs/docs/reference/metaprogramming/inline.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,25 @@ funkyAssertEquals(computeActual(), computeExpected(), computeDelta())
147147
Inline methods can override other non-inline methods. The rules are as follows:
148148

149149
1. If an inline method `f` implements or overrides another, non-inline method, the inline method can also be invoked at runtime. For instance, consider the scenario:
150-
```scala
151-
abstract class A {
152-
def f(): Int
153-
def g(): Int = f()
154-
}
155-
class B extends A {
156-
inline def f() = 22
157-
override inline def g() = f() + 11
158-
}
159-
val b = B()
160-
val a: A = b
161-
// inlined invocatons
162-
assert(b.f() == 22)
163-
assert(b.g() == 33)
164-
// dynamic invocations
165-
assert(a.f() == 22)
166-
assert(a.g() == 33)
167-
```
168-
The inlined invocations and the dynamically dispatched invocations give the same results.
150+
```scala
151+
abstract class A {
152+
def f(): Int
153+
def g(): Int = f()
154+
}
155+
class B extends A {
156+
inline def f() = 22
157+
override inline def g() = f() + 11
158+
}
159+
val b = B()
160+
val a: A = b
161+
// inlined invocatons
162+
assert(b.f() == 22)
163+
assert(b.g() == 33)
164+
// dynamic invocations
165+
assert(a.f() == 22)
166+
assert(a.g() == 33)
167+
```
168+
The inlined invocations and the dynamically dispatched invocations give the same results.
169169

170170
2. Inline methods are effectively final.
171171

0 commit comments

Comments
 (0)