Skip to content

Commit 367bf61

Browse files
committed
Remove compilation units for classes that have already been loaded
1 parent d4bb969 commit 367bf61

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ class ReadTastyTreesFromClasses extends FrontEnd {
2828
else {
2929
val unit = CompilationUnit.mkCompilationUnit(clsd, unpickled, forceTrees = true)
3030
val cls = clsd.symbol.asClass
31-
unit.pickled += (cls -> cls.unpickler.unpickler.bytes)
32-
cls.unpickler = null
33-
Some(unit)
31+
if (cls.unpickler == null) None // Has already been loaded by some other compilation unit
32+
else {
33+
unit.pickled += (cls -> cls.unpickler.unpickler.bytes)
34+
cls.unpickler = null
35+
Some(unit)
36+
}
3437
}
3538
}
3639
}

0 commit comments

Comments
 (0)