Skip to content

Commit 9a28005

Browse files
committed
Add scala syntax highlighting
1 parent 4f3069d commit 9a28005

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/docs/reference/implicit-by-name-parameters.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,28 @@ The precise steps for constructing an implicit argument for a by-name parameter
3333

3434
1. Create a new implicit value with a fresh name _lv_, which has the signature of the following definition:
3535

36-
implicit lazy val lv: T
36+
```scala
37+
implicit lazy val lv: T
38+
```
3739

3840
The current implementation uses the prefix `$lazy_implicit$` followed by a unique integer for _lv_.
3941

4042
1. This lazy val is not immediately available as candidate for implicit search (making it immediately available would result in a looping implicit computation). But it becomes available in all nested contexts that look again for an implicit argument to a by-name parameter.
4143

4244
1. If this implicit search succeeds with expression `E`, and `E` contains references to the lazy implicit value _lv_, replace `E` by
4345

44-
{ implicit lazy val lv: T = E; lv }
46+
47+
```scala
48+
{ implicit lazy val lv: T = E; lv }
49+
```
4550

4651
Otherwise, return `E` unchanged.
4752

4853
In the example above, the definition of `s` would be expanded as follows.
4954

50-
val s = implicitly[Test.Serializable[Option[Int]]](
51-
serializeOption[Int](serializeInt))
55+
```scala
56+
val s = implicitly[Test.Serializable[Option[Int]]](
57+
serializeOption[Int](serializeInt))
58+
```
5259

5360
No lazy val was generated because the synthesized argument is not recursive.

0 commit comments

Comments
 (0)