You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/metaprogramming/inline.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -285,11 +285,13 @@ val one: 1 = zero + 1
285
285
```
286
286
287
287
### Transparent vs. non-transparent inline
288
+
288
289
As we already discussed, transparent inline methods may influence type checking at call site.
289
290
Technically this implies that transparent inline methods must be expanded during type checking of the program.
290
291
Other inline methods are inlined later after the program is fully typed.
291
292
292
293
For example, the following two functions will be typed the same way but will be inlined at different times.
294
+
293
295
```scala
294
296
inlinedeff1:T= ...
295
297
transparentinlinedeff2:T= (...):T
@@ -298,7 +300,7 @@ transparent inline def f2: T = (...): T
298
300
A noteworthy difference is the behavior of `transparent inline given`.
299
301
If there is an error reported when inlining that definition, it will be considered as an implicit search mismatch and the search will continue.
300
302
A `transparent inline given` can add a type ascription in its RHS (as in `f2` from the previous example) to avoid the precise type but keep the search behavior.
301
-
On the other hand, `inline given`be taken as the implicit and then inlined after typing.
303
+
On the other hand, an `inline given`is taken as an implicit and then inlined after typing.
0 commit comments