Skip to content
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

Recursion limit exceeded on extending enum with higher-kinded and proper type #20329

Open
felher opened this issue May 3, 2024 · 0 comments
Open

Comments

@felher
Copy link
Contributor

felher commented May 3, 2024

Compiler version

3.3.3 LTS and 3.4.1

Minimized code

enum E[F[_], A]:
  case A extends E[Option, Int]
  case B extends E[Function0, Double]
  case C extends E[Function0, String]

Scastie: https://scastie.scala-lang.org/2rs9WkJ9S7Wft85WByTXtw

Output

For case C the compiler says:

Recursion limit exceeded.
Maybe there is an illegal cyclic reference?
If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
For the unprocessed stack trace, compile with -Yno-decode-stacktraces.
A recurring operation is (inner to outer):

  subtype [X0] >: Option[X0] & (() => X0) <: Option[X0] | (() => X0) <:< [R] =>> () => R

Expectation

Should compile (or give a clearer error message)

"Workaround"

Add a variance annotation to F[_]

@felher felher added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 3, 2024
@felher felher changed the title Recursion limit exceeded on extending enum with two type parameters Recursion limit exceeded on extending enum with higher-kinded and proper type May 3, 2024
@Gedochao Gedochao added area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 9, 2024
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