Skip to content

Type is inferred as Nothing when requiring implicit evidence =:= in nightly #7877

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

Closed
laurynaslubys opened this issue Dec 30, 2019 · 0 comments

Comments

@laurynaslubys
Copy link

minimized code

object Example extends App {

  trait ZSink[-R, +E, +A0, -A, +B] {
    def orElse[R1 <: R, E1, A00 >: A0, A1 <: A, C](
      that: ZSink[R1, E1, A00, A1, C]
    )(implicit ev: A1 =:= A00): ZSink[R1, E1, A00, A1, Either[B, C]] =
      ???
  }

  object ZSink {
    def identity[A]: ZSink[Any, Unit, Nothing, A, A] = ???
    def fail[E](e: E): ZSink[Any, E, Nothing, Any, Nothing] = ???
  }

  // compiles
  val a: ZSink[Any, String, Int, Int, Either[Int, Nothing]] = 
    ZSink.identity[Int].orElse(ZSink.fail("Ouch"))

  // cannot prove that Int =:= Nothing
  ZSink.identity[Int].orElse(ZSink.fail("Ouch"))
}

expectation

I would expect this to compile without explicitly stating the expected type.
This compiles on 0.21.0-RC1, but fails to compile on 0.22.0-bin-20191229-59152e9-NIGHTLY. I would hazard a guess that this is related to #7840

@smarter smarter closed this as completed in c252ffd Jan 7, 2020
smarter added a commit that referenced this issue Jan 7, 2020
Fix #7877: Refine instantiation criterion before implicit search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant