From 3039ecaeabc8fc3112f1f8c3c51dfa2a0fc8fa29 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Mon, 14 May 2018 19:02:12 +0200
Subject: [PATCH 1/2] Document meaning of constant expressions
Clarification following #4431.
The error checking's done by `Checking.checkInlineConformant(tree, isFinal =
false, "argument to inline parameter")`, and `checkInlineConformant` uses
`ConstantType` which characterizes constant expressions.
---
docs/docs/reference/inline.md | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/docs/docs/reference/inline.md b/docs/docs/reference/inline.md
index fd42ac1e14b4..e536117ad529 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,6 +125,13 @@ 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
From eedc6be7031f8b249b9154e9110af2d4058ed185 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Mon, 14 May 2018 19:59:07 +0200
Subject: [PATCH 2/2] Cleanups
---
docs/docs/reference/inline.md | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/docs/docs/reference/inline.md b/docs/docs/reference/inline.md
index e536117ad529..c43b0e8a59e4 100644
--- a/docs/docs/reference/inline.md
+++ b/docs/docs/reference/inline.md
@@ -136,7 +136,4 @@ 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).