File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1711,7 +1711,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
17111711 traverse(stats ++ rest)
17121712 case stat :: rest =>
17131713 val stat1 = typed(stat)(ctx.exprContext(stat, exprOwner))
1714- if (! ctx.isAfterTyper && isPureExpr(stat1))
1714+ if (! ctx.isAfterTyper && isPureExpr(stat1) && ! stat1.tpe.isRef(defn. UnitClass ) )
17151715 ctx.warning(em " a pure expression does nothing in statement position " , stat.pos)
17161716 buf += stat1
17171717 traverse(rest)
Original file line number Diff line number Diff line change @@ -4,4 +4,8 @@ object xfatalWarnings {
44 opt match { // error when running with -Xfatal-warnings
55 case None =>
66 }
7- }
7+
8+ object Test {
9+ while (true ) {} // should be ok. no "pure expression does nothing in statement position" issued.
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments