We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a84e4b commit 37540c7Copy full SHA for 37540c7
tests/run-macros/quote-matcher-power/Macro_1.scala
@@ -5,11 +5,11 @@ object Macros {
5
6
def power_s(x: Expr[Double], n: Int)(given QuoteContext): Expr[Double] =
7
if (n == 0) '{1.0}
8
- else if (n % 2 == 1) '{ ${x} * ${power_s(x, n - 1)} }
9
- else '{ val y = $x * $x; ${power_s('{y}, n / 2)} }
+ else if (n % 2 == 1) '{ $x * ${power_s(x, n - 1)} }
+ else '{ val y = $x * $x; ${power_s('y, n / 2)} }
10
11
inline def power(x: Double, inline n: Int): Double =
12
- ${power_s('{x}, n)}
+ ${power_s('x, n)}
13
14
def power2(x: Double, y: Double): Double = if y == 0.0 then 1.0 else x * power2(x, y - 1.0)
15
0 commit comments