Skip to content

Commit 1d512a7

Browse files
committed
Preload scala.util.control.NonFatal
1 parent fdb3540 commit 1d512a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dotty/tools/dotc/Driver.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ abstract class Driver extends DotClass {
5050
process(args, initCtx)
5151
}
5252

53-
def main(args: Array[String]): Unit =
53+
def main(args: Array[String]): Unit = {
54+
// Preload scala.util.control.NonFatal. Otherwise, when trying to catch a StackOverflowError,
55+
// we may try to load it but fail with another StackOverflowError and lose the original exception,
56+
// see <https://groups.google.com/forum/#!topic/scala-user/kte6nak-zPM>.
57+
val _ = NonFatal
5458
sys.exit(if (process(args).hasErrors) 1 else 0)
59+
}
5560
}
5661

5762
class FatalError(msg: String) extends Exception

0 commit comments

Comments
 (0)