aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/parsing/Parsers.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/parsing/Parsers.scala')
-rw-r--r--src/dotty/tools/dotc/parsing/Parsers.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala
index 71a03b9e2..d59e087cb 100644
--- a/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -1156,7 +1156,8 @@ object Parsers {
*/
def block(): Tree = {
val stats = blockStatSeq()
- if (stats.nonEmpty && !stats.last.isDef) Block(stats.init, stats.last)
+ def isExpr(stat: Tree) = !(stat.isDef || stat.isInstanceOf[Import])
+ if (stats.nonEmpty && isExpr(stats.last)) Block(stats.init, stats.last)
else Block(stats, EmptyTree)
}