diff --git a/docs/docs/reference/inline.md b/docs/docs/reference/inline.md index fd42ac1e14b4..c43b0e8a59e4 100644 --- a/docs/docs/reference/inline.md +++ b/docs/docs/reference/inline.md @@ -29,7 +29,8 @@ inlined at the point of use. Example: The `Config` object contains a definition of an `inline` value `logging`. This means that `logging` is treated as a constant value, equivalent to its right-hand side `false`. The right-hand side of such -an inline val must itself be a constant expression. Used in this way, +an inline val must itself be a [constant +expression](#the-definition-of-constant-expression). Used in this way, `inline` is equivalent to Java and Scala 2's `final`. `final` meaning "constant" is still supported in Dotty, but will be phased out. @@ -124,11 +125,15 @@ it in backticks, i.e. @`inline` def ... +### The definition of constant expression + +Right-hand sides of inline values and of arguments for inline parameters +must be constant expressions in the sense defined by the [SLS ยง +6.24](https://www.scala-lang.org/files/archive/spec/2.12/06-expressions.html#constant-expressions), +including "platform-specific" extensions such as constant folding of +pure numeric computations. ### Reference For more info, see [PR #1492](https://github.com/lampepfl/dotty/pull/1492) and -[Scala SIP 28](http://docs.scala-lang.org/sips/pending/inline-meta.html) - - - +[Scala SIP 28](http://docs.scala-lang.org/sips/pending/inline-meta.html).