8000 Empty Array constants results in a panic when generating LLVM · Issue #861 · inko-lang/inko · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Empty Array constants results in a panic when generating LLVM #861

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

Open
yorickpeterse opened this issue Apr 25, 2025 · 0 comments
Open

Empty Array constants results in a panic when generating LLVM #861

yorickpeterse opened this issue Apr 25, 2025 · 0 comments
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler
Milestone

Comments

@yorickpeterse
Copy link
Collaborator

Please describe the bug

If an array constant is empty, we don't correctly determine its type. This in turn results in a compile-time panic when generating LLVM code. For example, this snippet:

let NUMBERS = []

fn example(table: ref Array[Int]) {}

type async Main {
  fn async main {
    example(NUMBERS)
  }
}

Produces the following panic:

thread '<unnamed>' panicked at compiler/src/llvm/passes.rs:883:60:
no entry found for key
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'inko build test.inko' terminated by signal SIGABRT (Abort)

Given that empty array constants aren't useful (as they can never be modified such that they aren't empty), we should produce a compile-time error/diagnostic when encountering such arrays.

Operating system

Arch Linux

Inko version

main

@yorickpeterse yorickpeterse added accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler labels Apr 25, 2025
@yorickpeterse yorickpeterse added this to the 0.19.0 milestone Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting contributions Issues that are suitable to be worked on by anybody, not just maintainers bug Defects, unintended behaviour, etc compiler Changes related to the compiler
Projects
None yet
Development

No branches or pull requests

1 participant
0