From 09436e92155ff474af33601214373c82d778a71d Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Mon, 8 Apr 2019 23:11:36 +0200 Subject: [PATCH] Update compile-time stripMargin This test seems to suggest we can have two versions of `stripMargin` in the stdlib, one at compile-time and one at run-time. --- tests/run-with-compiler/reflect-inline/assert_1.scala | 2 +- tests/run-with-compiler/reflect-inline/test_2.scala | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/run-with-compiler/reflect-inline/assert_1.scala b/tests/run-with-compiler/reflect-inline/assert_1.scala index 029b7261dd99..f653c220e62c 100644 --- a/tests/run-with-compiler/reflect-inline/assert_1.scala +++ b/tests/run-with-compiler/reflect-inline/assert_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.tasty._ object api { - inline def (inline x: String) strip <: String = + inline def (inline x: String) stripMargin <: String = ${ stripImpl(x) } private def stripImpl(x: String)(implicit refl: Reflection): Expr[String] = diff --git a/tests/run-with-compiler/reflect-inline/test_2.scala b/tests/run-with-compiler/reflect-inline/test_2.scala index e2c09036de0d..d29a70c0f2a9 100644 --- a/tests/run-with-compiler/reflect-inline/test_2.scala +++ b/tests/run-with-compiler/reflect-inline/test_2.scala @@ -2,7 +2,9 @@ import api._ object Test { def main(args: Array[String]): Unit = { - assert(typeChecks("1 + 1".strip)) - assert(scala.testing.typeChecks("1 + 1".strip)) + val a: String = "5" + assert(typeChecks("|1 + 1".stripMargin)) + assert(scala.testing.typeChecks("|1 + 1".stripMargin)) + assert(("|3 + " + a).stripMargin == "3 + 5") } } \ No newline at end of file