Skip to content

Potential Issue Deriving Tags on Scala 3 #135

@adamgfraser

Description

@adamgfraser

This works:

import zio._

trait DgraphClient

object Example extends scala.App:

  type DgClient = Has[DgClient.Service]

  object DgClient:
    trait Service:
      val dgraphClient: UIO[DgraphClient]

    val getDgClient: URIO[DgClient, DgraphClient] =
      ZIO.accessM[DgClient](_.get.dgraphClient)

  println("It compiles!")

However, if I remove the return type of getDgClient like so:

import zio._

trait DgraphClient

object Example extends scala.App:

  type DgClient = Has[DgClient.Service]

  object DgClient:
    trait Service:
      val dgraphClient: UIO[DgraphClient]

    val getDgClient =
      ZIO.accessM[DgClient](_.get.dgraphClient)

  println("It compiles!")

Then I get the following error message:

could not find implicit value for izumi.reflect.Tag[Example.DgClient.Service]. Did you forget to put on a Tag, TagK or TagKK context bound on one of the parameters in Example.DgClient.Service? e.g. def x[T: Tag, F[_]: TagK] = ....
I found:

    izumi.reflect.Tag.tagFromTagMacro[Example.DgClient.Service]

But method tagFromTagMacro in object Tag does not match type izumi.reflect.Tag[Example.DgClient.Service].

Seems like that should work given that I am explicitly supplying the type parameter to accessM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions