From adf728a035c0fd19342e7affb923bdacd36bd63e Mon Sep 17 00:00:00 2001 From: Solal Pirelli Date: Wed, 12 Aug 2026 15:00:43 +0200 Subject: [PATCH] Test and fix --- .../tools/backend/jvm/GenericSignatures.scala | 2 +- tests/generic-java-signatures/26786.check | 1 + tests/generic-java-signatures/26786.scala | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/generic-java-signatures/26786.check create mode 100644 tests/generic-java-signatures/26786.scala diff --git a/compiler/src/dotty/tools/backend/jvm/GenericSignatures.scala b/compiler/src/dotty/tools/backend/jvm/GenericSignatures.scala index 09061037ce6b..f1f97a4fa73e 100644 --- a/compiler/src/dotty/tools/backend/jvm/GenericSignatures.scala +++ b/compiler/src/dotty/tools/backend/jvm/GenericSignatures.scala @@ -222,7 +222,7 @@ object GenericSignatures { builder.append("*") else // For bounded arguments, we can't translate it cleanly so emit an erased type - jsig(erasure(a.tycon)) + boxedSig(erasure(a.tycon)) case res => // value classes cannot appear as generic arguments jsig(res, vcBoxing = ValueClassBoxing.Box) diff --git a/tests/generic-java-signatures/26786.check b/tests/generic-java-signatures/26786.check new file mode 100644 index 000000000000..1ec7c20e6407 --- /dev/null +++ b/tests/generic-java-signatures/26786.check @@ -0,0 +1 @@ +public Check X.foo() diff --git a/tests/generic-java-signatures/26786.scala b/tests/generic-java-signatures/26786.scala new file mode 100644 index 000000000000..e0fb3b078af0 --- /dev/null +++ b/tests/generic-java-signatures/26786.scala @@ -0,0 +1,14 @@ +import compiletime.ops.int.> + +trait Check[Cond[T <: Int] <: Boolean]: + def apply(arg: Int): Unit + +type CondT = [t <: Int] =>> t > 0 + +class X: + val foo: Check[CondT] = new Check[CondT]: + def apply(arg: Int): Unit = () + +object Test: + def main(args: Array[String]): Unit = + classOf[X].getMethods.filter(_.getName.contains("foo")).sortBy(_.getName).foreach(m => println(m.toGenericString))