Skip to content

Bad interaction between self alias and opaque types #8143

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
nicolasstucki opened this issue Jan 30, 2020 · 0 comments
Closed

Bad interaction between self alias and opaque types #8143

nicolasstucki opened this issue Jan 30, 2020 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

minimized code

class Reflection(val internal: CompilerInterface) { self => // It works if the self is removed
  opaque type Flags = internal.Flags
  object Flags {
    def EmptyFlags: Flags = internal.Flags_EmptyFlags
  }
}

trait CompilerInterface {
  type Flags
  def Flags_EmptyFlags: Flags
}

Compilation output

-- [E007] Type Mismatch Error: Foo.scala:7:37 ----------------------------------
7 |    def EmptyFlags: Flags = internal.Flags_EmptyFlags
  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |                     Found:    Reflection.this.internal.Flags
  |                     Required: Reflection.this.Flags²
  |
  |                     where:    Flags  is a type in trait CompilerInterface
  |                               Flags² is a type in class Reflection

expectation

It should compile and be equivalent to the class without a self

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