Skip to content

Commit 8feb596

Browse files
authored
Merge pull request #4358 from dotty-staging/fix/java-tparams-cycle
Fix #4357: Avoid cyclic reference when parsing Java classfile
2 parents f2bb231 + ae2d13a commit 8feb596

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ object SymDenotations {
990990
*/
991991
private def companionNamed(name: TypeName)(implicit ctx: Context): Symbol =
992992
if (owner.isClass)
993-
owner.info.decl(name).suchThat(_.isCoDefinedWith(symbol)).symbol
993+
owner.unforcedDecls.lookup(name).suchThat(_.isCoDefinedWith(symbol)).symbol
994994
else if (!owner.exists || ctx.compilationUnit == null)
995995
NoSymbol
996996
else if (!ctx.compilationUnit.tpdTree.isEmpty)

tests/pos-java-interop/i4357/B_1.java

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public class B_1 extends A<B_1.C> {
2+
public static class C {};
3+
}
4+
class A<T> {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test {
2+
val b: B_1 = new B_1()
3+
}

0 commit comments

Comments
 (0)