From b4d86d5e8a5303470de581bceb0bc02416d9519c Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:43:51 -0700 Subject: [PATCH] Debug: don't assume completed state after `start` --- .../shared/src/test/scala/org/scalafmt/Debug.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scalafmt-tests/shared/src/test/scala/org/scalafmt/Debug.scala b/scalafmt-tests/shared/src/test/scala/org/scalafmt/Debug.scala index 41b778fefe..015db9751c 100644 --- a/scalafmt-tests/shared/src/test/scala/org/scalafmt/Debug.scala +++ b/scalafmt-tests/shared/src/test/scala/org/scalafmt/Debug.scala @@ -102,10 +102,11 @@ object Debug { ) iter(prev) } - if (null != completedEvent.finalState) { - iter(completedEvent.finalState) + val finalState = completedEvent.finalState + if (null != finalState) { + if (finalState ne State.start) iter(finalState) stack.foreach(LoggerOps.logger.debug) - LoggerOps.logger.debug(s"Total cost: ${completedEvent.finalState.cost}") + LoggerOps.logger.debug(s"Total cost: ${finalState.cost}") } } }