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

regression (?) in type inference after stricter variance checking in higher order type params #8522

Closed
scabug opened this issue Apr 21, 2014 · 3 comments · Fixed by scala/scala#8574

Comments

@scabug
Copy link

scabug commented Apr 21, 2014

trait IterateeT[F[_]]
trait StepT[F[_]]

class Test {
  def iterateeT[F[_]](s: F[StepT[F]]): IterateeT[F] = ???

  def fail[M[+_]]: IterateeT[M] = {
    val back: M[StepT[M]] = ???
    iterateeT(back) // fails after SI-2066 fix
  }

  def okay1[M[_]]: IterateeT[M] = {
    val back: M[StepT[M]] = ???
    iterateeT(back) // okay if M is invariant
  }

  def okay2[M[_]]: IterateeT[M] = {
    val back: M[StepT[M]] = ???
    iterateeT[M](back) // okay if type args are explicit
  }
}

Workarounds shown inline: make M invariant, or supply type arguments to iterateeT explicitly

@scabug
Copy link
Author

scabug commented Apr 21, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8522?orig=1
Reporter: @retronym
Affected Versions: 2.11.0-M8
See #2066

@scabug
Copy link
Author

scabug commented Apr 21, 2014

@retronym said (edited on Apr 21, 2014 7:55:02 PM UTC):
Minimized from http://pastebin.com/RFfd2Adp

Changed behaviour in scala/scala#3184

@joroKr21
Copy link
Member

joroKr21 commented Dec 4, 2019

Compiles since Scala 2.13.0

lrytz added a commit to scala/scala that referenced this issue Dec 4, 2019
@SethTisue SethTisue modified the milestones: Backlog, 2.13.0 Dec 4, 2019
@scala scala deleted a comment from scabug Dec 4, 2019
@scala scala deleted a comment from scabug Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants