diff --git a/izumi-reflect/izumi-reflect/src/main/scala-3/izumi/reflect/TagMacro.scala b/izumi-reflect/izumi-reflect/src/main/scala-3/izumi/reflect/TagMacro.scala index 743a452a..9ebbfa38 100644 --- a/izumi-reflect/izumi-reflect/src/main/scala-3/izumi/reflect/TagMacro.scala +++ b/izumi-reflect/izumi-reflect/src/main/scala-3/izumi/reflect/TagMacro.scala @@ -43,8 +43,6 @@ final class TagMacro(using override val qctx: Quotes) extends InspectorBase { typeRepr.dealias match { case x @ TypeRef(ThisType(_), _) if x.typeSymbol.isAbstractType && !x.typeSymbol.isClassDef => summonTag(x) - case x if x.typeSymbol.isTypeParam => summonTag(x) - case AppliedType(ctor, args) => val ctorTag = createTagExpr(ctor.asType) val argsTags = Expr.ofList(args.map(mkLtt)) @@ -65,6 +63,8 @@ final class TagMacro(using override val qctx: Quotes) extends InspectorBase { val ltts: Expr[List[LightTypeTag]] = Expr.ofList(ltts0) '{ Tag.unionTag[T](classOf[Any], $ltts) } + case x if x.typeSymbol.isTypeParam => summonTag(x) + case _ => throw new Exception(s"Unsupported type: $typeRepr") } diff --git a/izumi-reflect/izumi-reflect/src/test/scala-3/izumi/reflect/test/TagTest.scala b/izumi-reflect/izumi-reflect/src/test/scala-3/izumi/reflect/test/TagTest.scala index 411c124f..b8b05329 100644 --- a/izumi-reflect/izumi-reflect/src/test/scala-3/izumi/reflect/test/TagTest.scala +++ b/izumi-reflect/izumi-reflect/src/test/scala-3/izumi/reflect/test/TagTest.scala @@ -23,6 +23,15 @@ class TagTest extends SharedTagTest with TagAssertions { assertNotChild(Tag[Animal | String].tag, Tag[Dog | String].tag) } + "Support HKTag for unapplied type lambdas with type bounds" in { + trait X + trait XAble[A <: X] + class Y extends X + + def getTag[F[_ <: X]: Tag.auto.T] = Tag[F[Y]] + + assertSame(getTag[XAble].tag, Tag[XAble[Y]].tag) + } } }