From afc643aa5524657896b5b59a4d24e38d6bf03ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Doeraene?= Date: Mon, 25 Mar 2024 13:55:17 +0100 Subject: [PATCH] Fix #19633: Add regression test. Not sure what fixed it, but it seems to be good now. [Cherry-picked 230519f440c7c30d98b84fdf0341ee87f99e5fa8] --- tests/pos/i19633.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/pos/i19633.scala diff --git a/tests/pos/i19633.scala b/tests/pos/i19633.scala new file mode 100644 index 000000000000..d0c6a45b5f0a --- /dev/null +++ b/tests/pos/i19633.scala @@ -0,0 +1,24 @@ +object Repro { + trait Responsive { + type Response + } + + object Responsive { + type Aux[R] = Responsive {type Response = R} + type Response[R] = R match {case Aux[r] => r} + } + + case class StringRequest(name: String) extends Responsive { + type Response = String + } + + def withImplicit[R <: Responsive](request: R)(implicit ct: scala.reflect.ClassTag[Responsive.Response[R]]): Responsive.Response[R] = ??? + + def withFunction[R <: Responsive](request: R)(call: R => Responsive.Response[R]): Responsive.Response[R] = ??? + + def stringWithFunction(req: StringRequest): String = withFunction(req)(_.getClass.getSimpleName) + + def stringWithImplicit(req: StringRequest): String = withImplicit(req) + + def main(args: Array[String]): Unit = {} +}