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

TagMacro: invalid conversion from TagK3[F] to TagKK[F[Any, ?, ?]] #83

Closed
neko-kai opened this issue Sep 25, 2020 · 2 comments
Closed

TagMacro: invalid conversion from TagK3[F] to TagKK[F[Any, ?, ?]] #83

neko-kai opened this issue Sep 25, 2020 · 2 comments
Assignees
Labels
bug Something isn't working scala2 scala3

Comments

@neko-kai
Copy link
Member

Given:

trait BIO3[F[-_, +_, +_]]
type BIO[F[+_, +_]] = BIO3[Lambda[(`-R`, `+E`, `+A`) => F[E, A]]]

def direct[F[+_, +_]: TagKK] =
  Tag[BIO[F]].tag

def indirectFrom3[F[-_, +_, +_]: TagK3] = 
  direct[F[Any, +?, +?]]

println(indirectFrom3[zio.ZIO])
println(direct[zio.ZIO[Any, +?, +?]])

Results in indirectFrom3 returning an invalid, mangled tag:

BIO3[=λ %1,%2,%3 → ZIO[-Any,+3,+3]]

while direct is correct:

BIO3[=λ %1,%2,%3 → ZIO[-Any,+2,+3]]

The difference here is between the TagKK generated from TagK3 in indirectFrom3 and in direct TagKK in direct. Their printouts also differ:

def tag1[F[-_, +_, +_]: TagK3] = TagKK[F[Any, +?, +?]].tag
def tag2[F[-_, +_, +_]](implicit t: TagKK[F[Any, +?, +?]]) = TagKK[F[Any, +?, +?]].tag

println(s"tag1: ${tag1[zio.ZIO]}")
println(s"tag2: ${tag2[zio.ZIO]}")
tag1: λ %1,%2 → ZIO[-Any,+1,+2]
tag2: λ %0,%1 → ZIO[-Any,+0,+1]

/cc @pshirshov

@neko-kai neko-kai self-assigned this Sep 25, 2020
@pshirshov pshirshov added bug Something isn't working scala3 scala2 labels Oct 6, 2020
pshirshov added a commit that referenced this issue Aug 3, 2022
@pshirshov
Copy link
Member

Fixed in a222537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scala2 scala3
Projects
None yet
Development

No branches or pull requests

2 participants