Skip to content

Type Inference Issues in Latest Version of Dotty #7149

Closed
@adamgfraser

Description

@adamgfraser

We're seeing some type inference issues in trying to compile ZIO against the latest version of Dotty that don't entirely make sense to me. See compilation errors here. It appears that two of the issues can be minimized to the following:

trait ZIO[-R, +E, +A] { self =>

  final def +++[R1, B, E1 >: E](that: ZIO[R1, E1, B]): ZIO[Either[R, R1], E1, Either[A, B]] =
    for {
      e <- ZIO.environment[Either[R, R1]]
      r <- e.fold(self.map(Left(_)) provide _, that.map(Right(_)) provide _)
    } yield r
    // Found:    (Left[A, Any] | Right[Any, B])(r)
    // Required: Either[A, B]

  def flatMap[R1 <: R, E1 >: E, B](f: A => ZIO[R1, E1, B]): ZIO[R1, E1, B] = ???

  def map[B](f: A => B): ZIO[R, E, B] = ???

  def provide[R](R: R): ZIO[Any, E, A] = ???
}

object ZIO {
  def environment[R]: ZIO[R, Nothing, R] = ???
}

The other two also relate to types being inferred as Any and are here and here.

When you have the chance could you please advise whether there is an issue here or something we need to be doing differently? Thanks!

Copying @jdegoes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions