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] single digit unicode char causes panic #994

Closed
0rphon opened this issue Jun 2, 2021 · 2 comments
Closed

[Bug] single digit unicode char causes panic #994

0rphon opened this issue Jun 2, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@0rphon
Copy link
Contributor

0rphon commented Jun 2, 2021

🐛 Bug Report

The RFC states We also allow Unicode escapes of the form '\u{X}', where X is a sequence of one to six hex digits yet using a char with a single unicode digit causes a rust panic

possibly related to #993 but seems to have a different cause

Code snippet to reproduce

function main() {
    // error in leo, no error in rust
    let a = '\u1';
}

Stack trace & error message

D:\Work\leo-playground>D:\Work\leo_repos\leo\target\release\leo clean && D:\Work\leo_repos\leo\target\release\leo run
      Done Finished in 0 milliseconds 

     Build Starting...
     Build Compiling main program... ("D:\\Work\\leo-playground\\src/main.leo")
thread 'main' panicked at 'begin <= end (3 <= 2) when slicing `\u1`', parser\src\tokenizer\lexer.rs:116:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Your Environment

  • leo commit eaadb29
  • rustc version 1.53.0-nightly
  • Windows 10.0.19042 (Windows 10 Pro) [64-bit]
@0rphon 0rphon added bug Something isn't working fuzz-bug labels Jun 2, 2021
@damirka
Copy link
Contributor

damirka commented Jun 2, 2021

Hey @0rphon, here and in #993.
Unicode escapes require curly braces, so correct writing should be:

let a = '\u{1}';

I agree that parser message could be more descriptive. That we can improve.

@damirka
Copy link
Contributor

damirka commented Jun 2, 2021

I've summarized all bugs in #995.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants