Skip to content

Using type alias with dependent type produces error. Manual inlining makes the error go away. #12655

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
marcinzh opened this issue May 31, 2021 · 0 comments · Fixed by #14797
Closed

Comments

@marcinzh
Copy link

Compiler version

3.0.0

Minimized code

trait Signature:
  type Impl[A, U]

type Operation[Z <: Signature, A, U] = (z: Z) => z.Impl[A, U]

// This produces error:
case class Perform[Z <: Signature, A, U](op: Operation[Z, A, U])

// However, if I manually inline the type alias, the error goes away:
case class Perform_fix[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U])

// Also, using the alias in other contexts does not produce errors:
def foo[Z <: Signature, A, U](op: Operation[Z, A, U]): Unit = ???

Above snippet in Scastie: https://scastie.scala-lang.org/h8VPuvAMS72F42Cb11RubA

Output

Found:    (Perform.this.op : Operation[Z, A, U])
Required: Operation[<? <: Signature>, <?>, <?>]

Expectation

Not having to manually inline the type alias.

pweisenburger referenced this issue in pweisenburger/scala3 Mar 27, 2022
Closes lampepfl#3058
Closes lampepfl#10943
Closes lampepfl#12216
Closes lampepfl#12655
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