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

[BUG] Un-declared variables cause not graceful error messages #62

Open
Pillber opened this issue Mar 13, 2024 · 0 comments
Open

[BUG] Un-declared variables cause not graceful error messages #62

Pillber opened this issue Mar 13, 2024 · 0 comments

Comments

@Pillber
Copy link
Contributor

Pillber commented Mar 13, 2024

Describe the bug
When using a variable that has not been declared using let, instead of a nice raven error, the SimpleVariableManager panics.

Raven Code To Reproduce
In core/src/string.rv:

impl Cast<str> for u64 {
    pub fn cast(self, number: u64) -> str {
        do {
            let digit = number % 10;
            let char_digit = '0' + digit;
            output = char_digit + output;
            number /= 10;
        } while(number != 0);
    }
}

Here, the variable output is undeclared.

Error Output or Unexpected Behavior

Unresolved variable output from SimpleVariableManager { variables: {"self": Reference(Struct(FinalizedStruct { generics: {}, fields: [],
 data: u64 })), "digit": Reference(Reference(Struct(FinalizedStruct { generics: {}, fields: [], data: u64 }))), "number": Reference(Stru
ct(FinalizedStruct { generics: {}, fields: [], data: u64 })), "char_digit": Reference(Struct(FinalizedStruct { generics: {}, fields: [],
 data: char }))} }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'test::test::test_magpie' panicked at language\runner\src\lib.rs:58:25:
task 157 panicked

As far as I can tell, it is mad that output is being used, but it isn't one of those fancy parsing/syntax errors that someone has made

Additional context
More testing should be done around this. I just found this error and haven't done much to reproduce it, as it is the second error I have found while just trying to do number->string casting. I'll try and update this with more info when/if I get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant