Skip to content

Commit

Permalink
fix #628
Browse files Browse the repository at this point in the history
remove -indent and -rewrite options when evaluating expression
  • Loading branch information
adpi2 committed May 1, 2024
1 parent b6bdfe6 commit 4cc7019
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ object DebugTools {
debuggee.managedEntries.flatMap(loadExpressionCompiler).toMap
}

private val optionsToRemove = Set("-Xfatal-warnings", "-Werror")
private val optionsToRemove = Set("-Xfatal-warnings", "-Werror", "-indent", "-rewrite")

private def prepareOptions(options: Seq[String], toAdd: Seq[String]) = {
val withoutRemoved = options.filter(o => !optionsToRemove.contains(o))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ trait DebugTest extends CommonUtils {
continueIfPaused()
// This is flaky, terminated can happen before exited
if (!GithubUtils.isCI()) {
client.exited()
client.terminated()
client.exited(timeout = 4.seconds)
client.terminated(timeout = 4.seconds)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2692,4 +2692,27 @@ abstract class ScalaEvaluationTests(scalaVersion: ScalaVersion) extends DebugTes
implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(source, "example.Main", scalaVersion)
check(Breakpoint(6), if (isScala2) Breakpoint(6) else NoStep(), Evaluation.success("msg", "hello"))
}

test("i628: rewrite indent options") {
assume(scalaVersion.isScala3)
val source =
"""|package example
|
|object Main:
| def main(args: Array[String]): Unit =
| last(List(1))
|
| def last[A](l: List[A]): A = l match
| case lst :: Nil => lst
| case _ :: tail => last(tail)
| case Nil => throw new NoSuchElementException("last of empty list")
|""".stripMargin
implicit val debuggee: TestingDebuggee =
TestingDebuggee.mainClass(source, "example.Main", scalaVersion, Seq("-rewrite", "-indent"))
check(
Breakpoint(8),
Evaluation.success("l.size", 1),
Breakpoint(8)
)
}
}

0 comments on commit 4cc7019

Please sign in to comment.