Skip to content

Commit 37540c7

Browse files
Aggelos Biboudisnicolasstucki
Aggelos Biboudis
andauthored
Apply suggestions from code review
Co-Authored-By: Nicolas Stucki <nicolas.stucki@gmail.com>
1 parent 6a84e4b commit 37540c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/run-macros/quote-matcher-power/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ object Macros {
55

66
def power_s(x: Expr[Double], n: Int)(given QuoteContext): Expr[Double] =
77
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)} }
8+
else if (n % 2 == 1) '{ $x * ${power_s(x, n - 1)} }
9+
else '{ val y = $x * $x; ${power_s('y, n / 2)} }
1010

1111
inline def power(x: Double, inline n: Int): Double =
12-
${power_s('{x}, n)}
12+
${power_s('x, n)}
1313

1414
def power2(x: Double, y: Double): Double = if y == 0.0 then 1.0 else x * power2(x, y - 1.0)
1515

0 commit comments

Comments
 (0)