uiua-lang/uiua

Crash when using functions in the REPL on Windows

movpasd opened this issue · 3 comments

Hi there,

I'm new to Uiua and haven't submitted an issue before, so please let me know if there's any other information I can provide that could help.

image

If I try to define a function and then use it in the REPL, I get the error message above. Here it is in text for convenience:

Uiua 0.7.1 (end with ctrl+C)

» f = /+
↪ f ← /+
» f 1_2_3
↪ f 1_2_3
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: src\compile.rs:695

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 1: BaseThreadInitThunk
    at <unknown source file>
 2: RtlUserThreadStart
    at <unknown source file>
Error: The compiler has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
f 1_2_3

Setting COLORBT_SHOW_HIDDEN to 1 doesn't seem to modify the stack trace (including the line about setting the environment variable).

There seems to be no issue running the same code via uiua eval or uiua run, only within the REPL.

Contents of main.ua:

Func ← /+
Func 1_2_3

The version of Uiua is 0.7.1, and this is running on Windows 11, OS build 22621.3007. I've tried compiling from source on the latest commit and the issue is still there.

I've had a poke around at the offending line but am not sure what to make of it:

if let Some(index) = self.scope.names.get(name) {
    if let Global::Module { module } = &self.asm.bindings[*index].global { <----

(in src/compile.rs)

It looks like scopes.names is promising the index of a global binding but that binding doesn't exist? Happy to look into this in more detail but would need some pointers.

This has been fixed, though not released as a new version yet.
The fix is available on the main branch, which you can update to with:

uiua update --main

I'm going to leave this open until the new version is released, because many people have had this problem.

That's fantastic, cheers! :)

This should be fixed in the 0.8 release