diff --git a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala index 9392d9038574..c12c5c8b4a6e 100644 --- a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala +++ b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala @@ -455,7 +455,7 @@ object GenericSignatures { private class NeedsSigCollector(using Context) extends TypeAccumulator[Boolean] { override def apply(x: Boolean, tp: Type): Boolean = if (!x) - tp match { + tp.dealias match { case RefinedType(parent, refinedName, refinedInfo) => val sym = parent.typeSymbol if (sym == defn.ArrayClass) foldOver(x, refinedInfo) @@ -471,9 +471,7 @@ object GenericSignatures { foldOver(tp.typeParams.nonEmpty, parents) case AnnotatedType(tpe, _) => foldOver(x, tpe) - case proxy: TypeProxy => - foldOver(x, proxy) - case _ => + case tp => foldOver(x, tp) } else x diff --git a/tests/generic-java-signatures/aliases.check b/tests/generic-java-signatures/aliases.check new file mode 100644 index 000000000000..3e2613531871 --- /dev/null +++ b/tests/generic-java-signatures/aliases.check @@ -0,0 +1 @@ +scala.collection.immutable.List diff --git a/tests/generic-java-signatures/aliases.scala b/tests/generic-java-signatures/aliases.scala new file mode 100644 index 000000000000..6c22fa71b2db --- /dev/null +++ b/tests/generic-java-signatures/aliases.scala @@ -0,0 +1,10 @@ +class Foo { + type A = List[String] + def foo(): A = Nil +} + +object Test { + def main(args: Array[String]): Unit = { + println(classOf[Foo].getDeclaredMethod("foo").getGenericReturnType) + } +}