From 4c8f48ebda8a44f827b317238b64b703b4a26c82 Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Thu, 28 Mar 2024 14:42:35 +0100 Subject: [PATCH] Fix an incorrect form of a tuple type being generated This was found by the Scala 3 open CommunityBuild, and caused the macro expansion of the tests to fail compilation on scala 3.4.0. The previous implementation generated types which then could not be "inline matched" by the newer compiler, but somehow managaed to go through the cracks of the older compiler. --- .../scala-3/sttp/tapir/typelevel/IntersectionTypeMirror.scala | 3 ++- .../main/scala-3/sttp/tapir/typelevel/UnionTypeMirror.scala | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala-3/sttp/tapir/typelevel/IntersectionTypeMirror.scala b/core/src/main/scala-3/sttp/tapir/typelevel/IntersectionTypeMirror.scala index cb218f056f..ac7624b2fa 100644 --- a/core/src/main/scala-3/sttp/tapir/typelevel/IntersectionTypeMirror.scala +++ b/core/src/main/scala-3/sttp/tapir/typelevel/IntersectionTypeMirror.scala @@ -20,7 +20,8 @@ object IntersectionTypeMirror { private def derivedImpl[A](using Quotes, Type[A]): Expr[IntersectionTypeMirror[A]] = { import quotes.reflect.* - val tplPrependType = TypeRepr.of[? *: ?] + val tplPrependType = TypeRepr.of[? *: ?] match + case AppliedType(tycon, _) => tycon val tplConcatType = TypeRepr.of[Tuple.Concat] def prependTypes(head: TypeRepr, tail: TypeRepr): TypeRepr = diff --git a/core/src/main/scala-3/sttp/tapir/typelevel/UnionTypeMirror.scala b/core/src/main/scala-3/sttp/tapir/typelevel/UnionTypeMirror.scala index db42092662..e634a8b5d2 100644 --- a/core/src/main/scala-3/sttp/tapir/typelevel/UnionTypeMirror.scala +++ b/core/src/main/scala-3/sttp/tapir/typelevel/UnionTypeMirror.scala @@ -21,7 +21,8 @@ object UnionTypeMirror { private def derivedImpl[A](using Quotes, Type[A]): Expr[UnionTypeMirror[A]] = { import quotes.reflect.* - val tplPrependType = TypeRepr.of[? *: ?] + val tplPrependType = TypeRepr.of[? *: ?] match + case AppliedType(tycon, _) => tycon val tplConcatType = TypeRepr.of[Tuple.Concat] def prependTypes(head: TypeRepr, tail: TypeRepr): TypeRepr =