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

Interpreter: "BUG: missing local var migration from Nil to (String | Nil) (Exception)" #14770

Open
philipp-classen opened this issue Jul 1, 2024 · 0 comments

Comments

@philipp-classen
Copy link
Contributor

The following REPL session triggers an unhandled case in the interpreter:

raise "BUG: missing local var migration from #{current_type} to #{next_type}"

Using compiled compiler at github/crystal/.build/crystal
Crystal interpreter 1.13.0-dev [e279b3c7f] (2024-07-01).
EXPERIMENTAL SOFTWARE: if you find a bug, please consider opening an issue in
https://github.com/crystal-lang/crystal/issues/new/

icr:1> x = ""
 => ""
icr:2> y : String? = nil
 => nil
icr:3> y = x

BUG: missing local var migration from Nil to (String | Nil) (Exception)
  from github/crystal/src/compiler/crystal/interpreter/interpreter.cr:503:11 in 'migrate_local_vars'
  from github/crystal/src/compiler/crystal/interpreter/interpreter.cr:182:7 in 'interpret'
  from github/crystal/src/compiler/crystal/interpreter/repl.cr:92:5 in 'interpret'
  from github/crystal/src/compiler/crystal/interpreter/repl.cr:53:13 in 'parse_and_interpret'
  from github/crystal/src/compiler/crystal/interpreter/repl.cr:25:18 in 'run'
  from github/crystal/src/compiler/crystal/command/repl.cr:39:7 in 'repl'
  from github/crystal/src/compiler/crystal/command.cr:104:7 in 'run'
  from github/crystal/src/compiler/crystal/command.cr:55:5 in 'run'
  from github/crystal/src/compiler/crystal/command.cr:54:3 in 'run'
  from github/crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
  from github/crystal/src/crystal/main.cr:118:5 in 'main_user_code'
  from github/crystal/src/crystal/main.cr:104:7 in 'main'
  from github/crystal/src/crystal/main.cr:130:3 in 'main'
  from /usr/lib/libc.so.6 in '??'
  from /usr/lib/libc.so.6 in '__libc_start_main'
  from /home/phil/github/crystal/.build/crystal in '_start'
  from ???

Can be reproduced on master (tested with e279b3c)

OS: Arch Linux

$ crystal --version
Crystal 1.12.2 (2024-06-01)

LLVM: 17.0.6
Default target: x86_64-pc-linux-gnu
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