Skip to content

defining and using enum inside def produces runtime stack overflow #10139

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
weihsiu opened this issue Nov 1, 2020 · 1 comment
Closed

defining and using enum inside def produces runtime stack overflow #10139

weihsiu opened this issue Nov 1, 2020 · 1 comment

Comments

@weihsiu
Copy link

weihsiu commented Nov 1, 2020

Minimized code

object EnumTest:
  @main
  def run(): Unit =
    try
      enum Color:
        case Red, Green, Blue
      def paint(color: Color): Unit =
        println(s"painting with color $color")
      paint(Color.Red)
    catch
      case e => println(e)

Output

java.lang.StackOverflowError

Expectation

painting with color Red

after defining and using an enum inside a function, when the function is ran, it produces a StackOverflowError. if the enum is defined outside of the function, then everything works.

@bishabosha
Copy link
Member

bishabosha commented Nov 1, 2020

Hi thanks for opening this issue, this was fixed by #9677 and can be accessed in the nightly releases

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