Skip to content

Commit cab020d

Browse files
Merge pull request #6408 from dotty-staging/fix-#6403
Fix #6403: Do not intercept crashes
2 parents ef438e8 + d1a54fe commit cab020d

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,19 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
482482

483483
private def verifySignature(sym: Symbol, sig: String)(implicit ctx: Context): Unit = {
484484
import scala.tools.asm.util.CheckClassAdapter
485-
def wrap(body: => Unit): Boolean =
486-
try { body; true }
487-
catch { case ex: Throwable => println(ex.getMessage); false }
485+
def wrap(body: => Unit): Unit = {
486+
try body
487+
catch {
488+
case ex: Throwable =>
489+
ctx.error(i"""|compiler bug: created invalid generic signature for $sym in ${sym.denot.owner.showFullName}
490+
|signature: $sig
491+
|if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
492+
""".trim, sym.sourcePos)
493+
throw ex
494+
}
495+
}
488496

489-
val valid = wrap {
497+
wrap {
490498
if (sym.is(Flags.Method)) {
491499
CheckClassAdapter.checkMethodSignature(sig)
492500
}
@@ -497,14 +505,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
497505
CheckClassAdapter.checkClassSignature(sig)
498506
}
499507
}
500-
501-
if (!valid) {
502-
ctx.error(
503-
i"""|compiler bug: created invalid generic signature for $sym in ${sym.denot.owner.showFullName}
504-
|signature: $sig
505-
|if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
506-
""".trim, sym.sourcePos)
507-
}
508508
}
509509

510510
/**

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ 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+
println(s"Error while emitting ${int.sourceFileFor(item.cunit)}")
184+
throw ex
185185
}
186186
}
187187
}
@@ -414,8 +414,8 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
414414
addToQ3(item)
415415
} catch {
416416
case ex: Throwable =>
417-
ex.printStackTrace()
418-
ctx.error(s"Error while emitting ${item.plain.classNode.name}\n${ex.getMessage}")
417+
println(s"Error while emitting ${item.plain.classNode.name}")
418+
throw ex
419419
}
420420
}
421421
}

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -852,19 +852,14 @@ 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-
}
862+
val reporter = compile(sourceFiles, flags, true, outDir)
868863
if (reporter.compilerCrashed)
869864
fail(s"Compiler crashed when compiling: ${testSource.title}")
870865
case testSource@SeparateCompilationSource(_, dir, flags, outDir) => unsupported("NoCrashTest - SeparateCompilationSource")

0 commit comments

Comments
 (0)