From 1b9d12cbf198b63c02687eda62354169399c7848 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 18 Sep 2024 18:15:07 +0200 Subject: [PATCH] Add regresion test for #21576 --- tests/run/i21576.check | 3 +++ tests/run/i21576.scala | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/run/i21576.check create mode 100644 tests/run/i21576.scala diff --git a/tests/run/i21576.check b/tests/run/i21576.check new file mode 100644 index 000000000000..1bbe534c2782 --- /dev/null +++ b/tests/run/i21576.check @@ -0,0 +1,3 @@ +public SubFlow(SubFlowDef>,SubFlowDef>) +public SubFlowDef> SubFlow.delegate1() +public SubFlowDef> SubFlow.delegate2() diff --git a/tests/run/i21576.scala b/tests/run/i21576.scala new file mode 100644 index 000000000000..6b5515ac7719 --- /dev/null +++ b/tests/run/i21576.scala @@ -0,0 +1,31 @@ +// scalajs: --skip +import scala.annotation.unchecked.uncheckedVariance + +trait SubFlowDef[+F[+_]] +final class Flow1[-In]{ + type Repr[+O] = Flow1[In @uncheckedVariance] +} +final class Flow2[+Out]{ + type Repr[+O] = Flow2[O] +} +class SubFlow[In, Out]( + val delegate1: SubFlowDef[Flow1[In]#Repr], + val delegate2: SubFlowDef[Flow2[Out]#Repr] +) + +object Test { + def main(args: Array[String]): Unit = { + classOf[SubFlow[?, ?]] + .getConstructors() + .map(_.toGenericString()) + .sorted + .foreach(println) + + classOf[SubFlow[?, ?]] + .getMethods() + .filter(_.getName().startsWith("delegate")) + .map(_.toGenericString()) + .sorted + .foreach(println) + } +}