Skip to content

Inlined opaque type not equal to itself #6854

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 Jul 15, 2019 · 1 comment
Closed

Inlined opaque type not equal to itself #6854

nicolasstucki opened this issue Jul 15, 2019 · 1 comment

Comments

@nicolasstucki
Copy link
Contributor

minimized code

object Test {
  import Lib._
  val xs: IArray2[Int] = IArray2(1)
}

object Lib {
  opaque type IArray2[+T] = Array[_ <: T]

  object IArray2 {
    inline def apply(x: =>Int): IArray2[Int] = Array(x)
  }
}

expectation

Should work but fails with

4 |  val xs: IArray2[Int] = IArray2(1)
  |                         ^^^^^^^^^^
  |                         Found:    Lib.IArray2[Int]
  |                         Required: Lib.IArray2[Int]
@nicolasstucki
Copy link
Contributor Author

This pattern will not be supported. Inline methods cannot be defined in a context where there are the underlying type of opaque types is known. See #6853

nicolasstucki added a commit that referenced this issue Jul 16, 2019
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