Skip to content

Commit 9134d3f

Browse files
nicolasstuckiliufengyun
authored andcommitted
Add error when suspension has jar output
To avoid a compiler crash.
1 parent e1c8fdf commit 9134d3f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class GenBCode extends Phase {
5555
try super.runOn(units)
5656
finally myOutput match {
5757
case jar: JarArchive =>
58+
if (ctx.run.suspendedUnits.nonEmpty)
59+
// If we close the jar the next run will not be able to write on the jar.
60+
// But if we do not close it we cannot use it as part of the macro classpath of the suspended files.
61+
ctx.error("Can not suspend and output to a jar at the same time. See suspension with -Xprint-suspension.")
5862
jar.close()
5963
case _ =>
6064
}

0 commit comments

Comments
 (0)