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
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -344,10 +344,10 @@ In a transparent inline, an `inline if` will force the inlining of any inline de
344
344
## Inline Matches
345
345
346
346
A `match` expression in the body of an `inline` method definition may be
347
-
prefixed by the `inline` modifier. If there is enough static information to
348
-
unambiguously take a branch, the expression is reduced to that branch and the
349
-
type of the result is taken. If not, a compile-time error is raised that
350
-
reports that the match cannot be reduced.
347
+
prefixed by the `inline` modifier. If there is enough type information
348
+
at compile time to select a branch, the expression is reduced to that branch and the
349
+
type of the expression is the type of the right-hand side of that result.
350
+
If not, a compile-time error is raised that reports that the match cannot be reduced.
351
351
352
352
The example below defines an inline method with a
353
353
single inline match expression that picks a case based on its static type:
@@ -363,8 +363,9 @@ g("test") // Has type (String, String)
363
363
```
364
364
365
365
The scrutinee `x` is examined statically and the inline match is reduced
366
-
accordingly returning the corresponding value (with the type specialized because `g` is declared `transparent`). This example performs a simple type test over the
367
-
scrutinee. The type can have a richer structure like the simple ADT below.
366
+
accordingly returning the corresponding value (with the type specialized because `g` is declared `transparent`).
367
+
This example performs a simple type test over the scrutinee.
368
+
The type can have a richer structure like the simple ADT below.
368
369
`toInt` matches the structure of a number in [Church-encoding](https://en.wikipedia.org/wiki/Church_encoding)
0 commit comments