diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index ac4b108d3391..9a312054e4fc 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -32,6 +32,12 @@ object ClassfileParser { case tp @ AppliedType(tycon, args) => // disregard tycon itself, but map over it to visit the prefix tp.derivedAppliedType(mapOver(tycon), args.mapConserve(this)) + case tp @ TempPolyType(_, tpe) => + val tpe1 = this(tpe) + if (tpe1 eq tpe) tp else tp.copy(tpe = tpe1) + case tp @ TempClassInfoType(parents, _, _) => + val parents1 = parents.mapConserve(this) + if (parents eq parents1) tp else tp.copy(parentTypes = parents1) case _ => mapOver(tp) } @@ -154,7 +160,7 @@ class ClassfileParser( for (i <- 0 until in.nextChar) parseMember(method = false) for (i <- 0 until in.nextChar) parseMember(method = true) - classInfo = parseAttributes(classRoot.symbol, classInfo) + classInfo = cook.apply(parseAttributes(classRoot.symbol, classInfo)) if (isAnnotation) addAnnotationConstructor(classInfo) val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, classRoot, moduleRoot) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 4412e8a8714b..6d2dc9ba8079 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -66,6 +66,7 @@ class CompilationTests extends ParallelTesting { ), scala2Mode ) + + compileFilesInDir("../tests/pos-special/i3273", defaultOptions) + compileFilesInDir("../tests/pos-special/spec-t5545", defaultOptions) + compileFilesInDir("../tests/pos-special/strawman-collections", defaultOptions) + compileFile("../scala2-library/src/library/scala/collection/immutable/IndexedSeq.scala", defaultOptions) + diff --git a/tests/pos-special/i3273/test/Bar_1.java b/tests/pos-special/i3273/test/Bar_1.java new file mode 100644 index 000000000000..09c52493544b --- /dev/null +++ b/tests/pos-special/i3273/test/Bar_1.java @@ -0,0 +1,8 @@ +class Bar_1 { + static abstract class A extends B { + abstract B foo(); + } + static abstract class B { + abstract A bar(); + } +} diff --git a/tests/pos-special/i3273/test/client_2.scala b/tests/pos-special/i3273/test/client_2.scala new file mode 100644 index 000000000000..a11f17f5ed8a --- /dev/null +++ b/tests/pos-special/i3273/test/client_2.scala @@ -0,0 +1,5 @@ +class Client { + val a = (_: Bar_1.A[AnyRef]).foo() + val b = (_: Bar_1.B[AnyRef]).bar() + def test(x: Bar_1.A[AnyRef]): Bar_1.B[_] = x +}