Closed
Description
Compiler version
3.0.2, 3.0.1
Code below compiles in 3.0.0 (and 2.12-2.13), but fails compilation in 3.0.2 and 3.0.1
Minimized code
Note that even replacing
val a: ZIO[Int, Nothing, Symbol] = Get ~> c(CA())
with
val a: ZIO[Int, Nothing, Symbol] = ???
or moving suite
from top level to object or removing useless WithTransformation
will fix compilation.
trait ZIO[-A, +B, +C]
trait Spec[-A, +B]
def suite[R, E, T](specs: Spec[R, E]*): Spec[R, E] = ???
trait HttpRequest
trait RequestContext
trait RouteResult
case class CA()
object CA {
implicit val aEv: Ev[CA] = ???
}
trait CB
trait Ev[T]
object CB {
implicit def apply[T](a: T)(implicit ev: Ev[T]): CB = ???
}
def c(b: CB): RequestContext => Option[RouteResult] = ???
object RouteDefaultRunnableSpec {
def assertM[R, E, A](effect: ZIO[R, E, A]): ZIO[R, E, String] = ???
def testM[R, E](assertion: => ZIO[R, E, String]): Spec[R, E] = ???
val Get: HttpRequest = ???
implicit class WithTransformation(request: HttpRequest) {
def ~>(f: HttpRequest => HttpRequest): HttpRequest = f(request)
}
implicit class WithRoute(request: HttpRequest) {
def ~>(route: RequestContext => Option[RouteResult]): ZIO[Int, Nothing, Symbol] = ???
}
def spec =
suite(
testM {
val a: ZIO[Int, Nothing, Symbol] = Get ~> c(CA())
val res: ZIO[Int, Nothing, String] = assertM(a)
res
},
)
}
Output
[error] -- [E007] Type Mismatch Error: /file/path/something.scala:48:8
[error] 48 | res
[error] | ^^^
[error] | Found: (res : ZIO[Int, Nothing, String])
[error] | Required: ZIO[Any, Any, String]
Expectation
Code should be compilable. Compilation of this code should not depend on val
implementation if type of val
is specified manually.