Skip to content

Incorrect type error in a diamond class hierarchy #8933

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
julienrf opened this issue May 10, 2020 · 0 comments · Fixed by #8944
Closed

Incorrect type error in a diamond class hierarchy #8933

julienrf opened this issue May 10, 2020 · 0 comments · Fixed by #8944

Comments

@julienrf
Copy link
Contributor

Minimized code

trait Foo[F[_]]

trait Top {
  type F[X]
  def foo: Foo[F]
}

trait Left extends Top

trait Right extends Top {
  trait F[X]
  def foo: Foo[F] = new Foo[F] {}
}

class Bottom extends Left with Right

Output

[error] -- Error:
[error] 17 |object Bottom extends Left with Right
[error]    |       ^
[error]    |method foo in trait Right is not a legal implementation of `foo` in class Bottom
[error]    |  its type             => Foo[Bottom.F]
[error]    |  does not conform to  => Foo[Bottom.F] & Foo[Bottom.F]

Expectation

The expected type for member foo in Bottom should be reduced to Foo[F] instead of Foo[F] & Foo[F], and the code would compile.

odersky added a commit to dotty-staging/dotty that referenced this issue May 11, 2020
@nicolasstucki nicolasstucki linked a pull request May 11, 2020 that will close this issue
odersky added a commit that referenced this issue May 11, 2020
Fix #8933: Fix eta expansion when comparing hk types
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.

1 participant