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

Erroneous behavior with trait type reference #8493

Closed
scabug opened this issue Apr 10, 2014 · 2 comments
Closed

Erroneous behavior with trait type reference #8493

scabug opened this issue Apr 10, 2014 · 2 comments

Comments

@scabug
Copy link

scabug commented Apr 10, 2014

object Bug {

  trait Foo {
    def foo: this.type
  }

  case class Impl() extends Foo {
    def foo = ???

    def bar: Unit = ()
  }

  object Foo {
    def foo(f: Foo): f.type = f.foo
  }

  def work(f: Impl): Unit =
    Foo.foo(f).bar

  def bug(f: Int => Impl): Unit =
    Foo.foo(f(1)).bar

  def workaround(f: Int => Impl): Unit = {
    val tmp = f(1)

    Foo.foo(tmp).bar
  }
}
<console>:27: error: value bar is not a member of Bug.Foo
           Foo.foo(f(1)).bar
@scabug
Copy link
Author

scabug commented Apr 10, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8493?orig=1
Reporter: Yorick Laupa (yoeight_)
Affected Versions: 2.10.4

NthPortal added a commit to scala/scala that referenced this issue Aug 28, 2021
@SethTisue SethTisue changed the title Errorneous behavior with trait type reference Erroneous behavior with trait type reference Aug 29, 2021
@SethTisue
Copy link
Member

not sure what the fix version should be

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

2 participants