Skip to content

Commit bcb5666

Browse files
nicolasstuckicheeseng
authored andcommitted
Remove inline argument from stripMargin
1 parent 14f3d2a commit bcb5666

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scalatest.dotty/src/main/scala/org/scalatest/Assertions.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,8 +1293,8 @@ trait Assertions extends TripleEquals {
12931293
*/
12941294
final val succeed: Assertion = Succeeded
12951295

1296-
inline def (inline x: String) stripMargin : String =
1297-
${ org.scalatest.Assertions.stripMarginImpl(x) }
1296+
inline def (x: String) stripMargin : String =
1297+
${ org.scalatest.Assertions.stripMarginImpl('x) }
12981298
}
12991299

13001300
/**
@@ -1341,9 +1341,12 @@ trait Assertions extends TripleEquals {
13411341
*/
13421342
object Assertions extends Assertions {
13431343
import scala.quoted._
1344+
import scala.quoted.matching.Const
13441345

1345-
def stripMarginImpl(x: String)(implicit qctx: QuoteContext): Expr[String] =
1346-
Expr(new scala.collection.immutable.StringOps(x).stripMargin)
1346+
def stripMarginImpl(x: Expr[String])(implicit qctx: QuoteContext): Expr[String] = x match {
1347+
case Const(str) => Expr(new scala.collection.immutable.StringOps(str).stripMargin)
1348+
case _ => '{ new scala.collection.immutable.StringOps($x).stripMargin }
1349+
}
13471350

13481351
@deprecated("The trap method is no longer needed for demos in the REPL, which now abreviates stack traces, so NormalResult will be removed in a future version of ScalaTest")
13491352
case class NormalResult(result: Any) extends Throwable {

0 commit comments

Comments
 (0)