Skip to content

Commit e6130d9

Browse files
committed
Fix compilation units not beeing loaded if already loaded symbol
Not all classes where loaded depending on the order of the compilation
1 parent 69a280f commit e6130d9

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ class ReadTastyTreesFromClasses extends FrontEnd {
6666
clsd.infoOrCompleter match {
6767
case info: ClassfileLoader =>
6868
info.load(clsd) // sets cls.treeOrProvider and cls.moduleClass.treeProvider as a side-effect
69-
def moduleClass = clsd.owner.info.member(className.moduleClassName).symbol
70-
compilationUnit(clsd.classSymbol).orElse(compilationUnit(moduleClass))
7169
case _ =>
72-
alreadyLoaded()
7370
}
71+
def moduleClass = clsd.owner.info.member(className.moduleClassName).symbol
72+
compilationUnit(clsd.classSymbol).orElse(compilationUnit(moduleClass))
7473
case _ =>
7574
cannotUnpickle(s"no class file was found")
7675
}

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class FromTastyTests extends ParallelTesting {
2929
val (step1, step2, step3) = compileTastyInDir("tests/pos", defaultOptions,
3030
blacklist = Set(
3131
"macro-deprecate-dont-touch-backquotedidents.scala",
32-
33-
// Compiles wrong class
34-
"simpleClass.scala",
32+
"t247.scala",
3533

3634
// Wrong number of arguments
3735
"i3130b.scala",
@@ -84,6 +82,7 @@ class FromTastyTests extends ParallelTesting {
8482
blacklist = Set(
8583

8684
"t7223.scala",
85+
"t5428.scala",
8786

8887
// Missing position
8988
"Course-2002-13.scala",

tests/pos/simpleClass-2.decompiled

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
================================================================================
2+
out/posTestFromTasty/pos2/simpleClass-2/foo/B.class
3+
--------------------------------------------------------------------------------
4+
package foo {
5+
class B() extends Object() {}
6+
}
7+
--------------------------------------------------------------------------------
8+
================================================================================
9+
out/posTestFromTasty/pos2/simpleClass-2/foo/A.class
10+
--------------------------------------------------------------------------------
11+
package foo {
12+
class A() extends foo.B() {}
13+
}
14+
--------------------------------------------------------------------------------

tests/pos/simpleClass-2.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package foo
2+
3+
class B
4+
5+
class A extends B
6+

tests/pos/simpleClass.decompiled

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
================================================================================
2-
out/posTestFromTasty/pos/simpleClass/foo/A.class
2+
out/posTestFromTasty/pos2/simpleClass/foo/B.class
3+
--------------------------------------------------------------------------------
4+
package foo {
5+
class B() extends foo.A() {}
6+
}
7+
--------------------------------------------------------------------------------
8+
================================================================================
9+
out/posTestFromTasty/pos2/simpleClass/foo/A.class
310
--------------------------------------------------------------------------------
411
package foo {
512
class A() extends Object() {}

0 commit comments

Comments
 (0)