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
As we already discussed, transparent inline methods will provide a more precise.
289
+
Technically this implies that transparent inline methods must be expanded while typing the program. Other inline methods are inlined later after the program is fully typed.
290
+
291
+
For example the following two functions will be typed the same way but will be inlined at different times.
292
+
```scala
293
+
inlinedeff1:T= ...
294
+
transparentinlinedeff2:T= (...):T
295
+
```
296
+
297
+
A noteworthy difference is the behavior of `transparent inline given`.
298
+
If there is an error reported when inlining that definition, it will be considered as an implicit search mismatch and the search will continue.
299
+
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.
300
+
On the other hand `inline given` be taken as the implicit and then after typing is done the code is inlined and any error will be emitted as usual.
301
+
287
302
## Inline Conditionals
288
303
289
304
An if-then-else expression whose condition is a constant expression can be simplified to
@@ -313,6 +328,8 @@ below:
313
328
|This location is in code that was inlined at ...
314
329
```
315
330
331
+
In a transparent inline, an `inline if` will force the inlining of any inline definition in its condition.
332
+
316
333
## Inline Matches
317
334
318
335
A `match` expression in the body of an `inline` method definition may be
0 commit comments