Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partially #30 (only Scala 3) #278

Merged
merged 1 commit into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

}
Expand Down