From a88088af2e942805b488257d421a7efb0237e893 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Wed, 8 Apr 2026 12:21:19 -0700 Subject: [PATCH] Don't pop root region when skipping --- compiler/src/dotty/tools/dotc/parsing/Scanners.scala | 2 +- tests/neg/i25683.scala | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i25683.scala diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index b8ebab3b91c2..1ff4e1609083 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -369,7 +369,7 @@ object Scanners { } case OUTDENT => currentRegion match - case r: Indented => currentRegion = r.enclosing + case r: Indented if !r.isOutermost => currentRegion = r.enclosing case _ => case STRINGLIT => currentRegion match { diff --git a/tests/neg/i25683.scala b/tests/neg/i25683.scala new file mode 100644 index 000000000000..071a792ed145 --- /dev/null +++ b/tests/neg/i25683.scala @@ -0,0 +1,9 @@ +object OptionExample { + def f(x: Any) = () + def example = { + f( + if ( + false + ) + ) // error + val someVal // error