Skip to content

Commit 08f4679

Browse files
authored
Merge pull request #4269 from dotty-staging/fix-4217
Fix #4217: display warnings in repl
2 parents af7bde7 + d774cef commit 08f4679

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ class ReplDriver(settings: Array[String],
235235
val newImports = newState.imports ++ extractImports(parsed.trees)
236236
val newStateWithImports = newState.copy(imports = newImports)
237237

238+
// display warnings
239+
displayErrors(newState.run.runContext.flushBufferedMessages())(newState)
240+
238241
displayDefinitions(unit.tpdTree, newestWrapper)(newStateWithImports)
239242
}
240243
}

compiler/test-resources/repl/i4217

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
scala> def foo(x: Option[Int]) = x match { case None => }
2+
1 | def foo(x: Option[Int]) = x match { case None => }
3+
| ^
4+
| match may not be exhaustive.
5+
|
6+
| It would fail on pattern case: Some(_)
7+
def foo(x: Option[Int]): Unit

0 commit comments

Comments
 (0)