Skip to content

Commit ab42b4d

Browse files
committed
Fix #6403: Do not intercept crashes
Emitting an error when the backend crashes hides the crash from the reporter and fails which cannot be identified by the testing framework.
1 parent fbc9d0a commit ab42b4d

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
180180
try { /*withCurrentUnit(item.cunit)*/(visit(item)) }
181181
catch {
182182
case ex: Throwable =>
183-
ex.printStackTrace()
184-
ctx.error(s"Error while emitting ${int.sourceFileFor(item.cunit)}\n${ex.getMessage}")
183+
throw new Exception(s"Error while emitting ${int.sourceFileFor(item.cunit)}", ex)
185184
}
186185
}
187186
}

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -852,21 +852,21 @@ trait ParallelTesting extends RunnerOrchestration { self =>
852852
extends Test(testSources, times, threadLimit, suppressAllOutput) {
853853
protected def encapsulatedCompilation(testSource: TestSource) = new LoggedRunnable {
854854
def checkTestSource(): Unit = tryCompile(testSource) {
855-
def fail(msg: String): Nothing = {
855+
def fail(msg: String): Unit = {
856856
echo(msg)
857857
failTestSource(testSource)
858-
???
859858
}
860859
testSource match {
861860
case testSource@JointCompilationSource(_, files, flags, outDir, fromTasty, decompilation) =>
862861
val sourceFiles = testSource.sourceFiles
863-
val reporter =
864-
try compile(sourceFiles, flags, true, outDir)
865-
catch {
866-
case ex: Throwable => fail(s"Fatal compiler crash when compiling: ${testSource.title}")
867-
}
868-
if (reporter.compilerCrashed)
869-
fail(s"Compiler crashed when compiling: ${testSource.title}")
862+
try {
863+
val reporter = compile(sourceFiles, flags, true, outDir)
864+
if (reporter.compilerCrashed)
865+
fail(s"Compiler crashed when compiling: ${testSource.title}")
866+
}
867+
catch {
868+
case ex: Throwable => fail(s"Fatal compiler crash when compiling: ${testSource.title}")
869+
}
870870
case testSource@SeparateCompilationSource(_, dir, flags, outDir) => unsupported("NoCrashTest - SeparateCompilationSource")
871871
}
872872
registerCompletion()

0 commit comments

Comments
 (0)