Skip to content

[BUG] Syntax Errors in Core files in internal functions causes weird error messages #65

@Pillber

Description

@Pillber

Describe the bug
If making an internal trait in the core standard library, (say string.rv) and any keywords are misspelled, the parser panics and also displays an incorrect parsing error message.

Raven Code To Reproduce
in string.rv:

internal impl Add<char, str> for char {
    pub fun add(self, other: str) -> str {
    //   ^ wrong token
    }
}

Error Output or Unexpected Behavior
when running cargo test --bin magpie -- --nocapture:

running 1 test
Running arrays::test
thread 'io-runtime' panicked at language\parser\src\parser\struct_parser.rs:204:18:
How'd you get here? string - FieldName (2, lic fn add(self, other)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Errors:
Failed to find type strcmp, did you import it correctly?
in file string.rv:16:21
   |
16 |         return strcmp(self, other) == 0;
   |                      ^
thread 'test::test::test_magpie' panicked at tools\magpie\src\test.rs:52:32:
Failed to compile test arrays::test!
test test::test::test_magpie ... FAILED

failures:

failures:
    test::test::test_magpie

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

error: test failed, to rerun pass `-p magpie --bin magpie`

Additional context
This may or may not happen in other places, but this place is for sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions