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