uiua-lang/uiua

Crash (2x import of bad file)

bkDJ opened this issue · 3 comments

bkDJ commented

It's my fault for not updating a reference after renaming a function, and the error was clear enough to me to fix my code (within an imported function, I was calling a function that did not exist) but I'll report anyway. I had --main installed, commit 180f6e7.

The application panicked (crashed).
Message:  no entry found for key
Location: src/compile.rs:427

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 10 frames hidden ⋮                              
11: core::option::expect_failed::hfc92202fffb4ec7f
    at <unknown source file>
12: <std::collections::hash::map::HashMap<K,V,S> as core::ops::index::Index<&Q>>::index::h3b24bcfc41640ed8
    at <unknown source file>
13: uiua::compile::Compiler::items::hfa8d41ee6d068b0f
    at <unknown source file>
14: std::panicking::try::h6884f0563b1a1647
    at <unknown source file>
15: uiua::compile::Compiler::load_impl::h4e8fb1167f189fe6
    at <unknown source file>
16: uiua::compile::Compiler::load_file::hb9eab788eb8bdebe
    at <unknown source file>
17: uiua::run::Uiua::compile_run::hf5b0aa431b1087b6
    at <unknown source file>
18: uiua::main::h92b1f986b4b0bbc7
    at <unknown source file>
19: std::sys_common::backtrace::__rust_begin_short_backtrace::h10edddde2e4bbc16
    at <unknown source file>
20: std::rt::lang_start::{{closure}}::h4926783816a5d60e
    at <unknown source file>
21: std::panicking::try::h0f4fc6a6c293a630
    at <unknown source file>
22: std::rt::lang_start_internal::h87f8a3eec40cef68
    at <unknown source file>
23: std::rt::lang_start::h6084fd599ee2a7f4
    at <unknown source file>
24: _main
    at <unknown source file>
Error: Unknown identifier `NthPrime`
  at ../lib/prime.ua:20:23
20 | MaxNthPrime ← +1⌈×Phi NthPrime
                           ────────
Error: The compiler has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
Primes ← &i "../lib/prime.ua" "SieveTo"
NthPrimeBelow ← &i "../lib/prime.ua" "MaxNthPrime"

Sol ← Primes NthPrimeBelow
Sol 7

Do you know of a way I can reproduce this crash?

bkDJ commented

Sure, here's a pretty minimal repro. Trying to interpret bar.ua causes a crash.

Files

repro/foo.ua

AnythingThatWouldBeInvalidCode

repro/bar.ua

A ← &i "foo.ua" "A"
B ← &i "foo.ua" "B"

Even if foo.ua had something normal like a proper definition of A and B, but an interpreter error further down, bar.ua would still crash. It might be due to the two imports from a bad file?

The new module system should handle this correctly.