Skip to content

Unexpected non-private type access #7859

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
Atry opened this issue Dec 28, 2019 · 1 comment
Closed

Unexpected non-private type access #7859

Atry opened this issue Dec 28, 2019 · 1 comment
Assignees

Comments

@Atry
Copy link
Contributor

Atry commented Dec 28, 2019

minimized code

  trait Lub2[A, B] {
    type Output
  }
  given [A <: C, B <: C, C]: Lub2[A, B] {
    type Output = C
  }

  trait Lub[Union] {
    type Output
  }

  given [A]:Lub[A] {
    type Output = A
  }

  // non-private type Output in class given_Lub_Left refers to private value lub2
  // in its type signature  = given_Lub_Left.this.lub2.Output
  given [Left, Right](given lubLeft: Lub[Right], lubRight: Lub[Right])(given lub2: Lub2[lubLeft.Output, lubRight.Output]): Lub[Left | Right] {
    type Output = lub2.Output
  }

expectation

It should compile because the identical code compiles as following:

  given [Left, Right](given lubLeft: Lub[Right], lubRight: Lub[Right])(given lub2: Lub2[lubLeft.Output, lubRight.Output]): (Lub[Left | Right] {
    type Output = lub2.Output
  }) = new Lub[Left | Right] {
    type Output = lub2.Output
  }
@Atry Atry added the itype:bug label Dec 28, 2019
@odersky
Copy link
Contributor

odersky commented Jan 8, 2020

The identical code has a different type, though: It's Lub[Left | Right], without the type refinement. But that begs the question how we can get a path dependency on a parameter of a given instance. Something is clearly missing here.

@odersky odersky self-assigned this Jan 8, 2020
odersky added a commit to dotty-staging/dotty that referenced this issue Mar 2, 2020
@odersky odersky closed this as completed in 3145891 Mar 2, 2020
odersky added a commit that referenced this issue Mar 2, 2020
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