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

Compiler doesn't realize that private function is top-level #10426

Open
BrucePerens opened this issue Feb 20, 2021 · 0 comments
Open

Compiler doesn't realize that private function is top-level #10426

BrucePerens opened this issue Feb 20, 2021 · 0 comments

Comments

@BrucePerens
Copy link

Compiling this:

private def test
  data = self
end
test

results in this:

Module validation failed: Stored value type does not match pointer operand type!
  store i32 1511, i1* %data, !dbg !9
 i1Function return type does not match operand type of return inst!
  ret i32 1511, !dbg !9
 i1 (Exception)
  from /crystal/src/string.cr:5017:14 in 'finish'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:69:7 in 'codegen'
  from /crystal/src/compiler/crystal/compiler.cr:172:16 in 'compile'
  from /crystal/src/compiler/crystal/command.cr:210:5 in 'run_command'
  from /crystal/src/compiler/crystal/command.cr:117:7 in 'run'
  from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
  from /crystal/src/crystal/main.cr:110:5 in 'main'
  from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
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