Skip to content

Commit 09436e9

Browse files
committed
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.
1 parent 0d0274b commit 09436e9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/run-with-compiler/reflect-inline/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22
import scala.tasty._
33

44
object api {
5-
inline def (inline x: String) strip <: String =
5+
inline def (inline x: String) stripMargin <: String =
66
${ stripImpl(x) }
77

88
private def stripImpl(x: String)(implicit refl: Reflection): Expr[String] =

tests/run-with-compiler/reflect-inline/test_2.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import api._
22

33
object Test {
44
def main(args: Array[String]): Unit = {
5-
assert(typeChecks("1 + 1".strip))
6-
assert(scala.testing.typeChecks("1 + 1".strip))
5+
val a: String = "5"
6+
assert(typeChecks("|1 + 1".stripMargin))
7+
assert(scala.testing.typeChecks("|1 + 1".stripMargin))
8+
assert(("|3 + " + a).stripMargin == "3 + 5")
79
}
810
}

0 commit comments

Comments
 (0)