leo icon indicating copy to clipboard operation
leo copied to clipboard

[Bug] incorrect error message for type mismatch

Open 0rphon opened this issue 2 years ago • 1 comments

🐛 Bug Report

the following error message points to where the variable was declared instead of where the actual error is. probably the result of https://github.com/AleoHQ/leo/pull/1864

Code snippet to reproduce

function main(a: u8) -> u8 {
    let x: u8 = 1u8;
    let y: u32 = 1u32;
    let z: u8 = x + y;
    return z;
}

Stack trace & error message

E:\Work\Aleo\leo-playground>leo\target\debug\leo.exe build
     Build Starting...
     Build Compiling main program... ("E:\\Work\\Aleo\\leo-playground\\src/main.leo")
Error [ETYC0372002]: Found type `u32` but type `u8` was expected
    --> E:\Work\Aleo\leo-playground\src/main.leo:3:5
     |
   3 |     let y: u32 = 1u32;
     |     ^^^^^^^^^^^^^^^^^
      Done Finished in 10 milliseconds

Your Environment

  • testnet3 commit 64c47f8bf909d3dfb608cba4486c7b9b196ec812

0rphon avatar Jun 15 '22 21:06 0rphon

this was fixed on #1866 but seems to still be an issue on testnet3 as of 5b572278fb1edc94f17807222fe3b710e3ae9962. maybe the change never got carried over?

0rphon avatar Jun 21 '22 19:06 0rphon

This is fixed on Leo v1.6.2

Error [ETYC0372003]: Expected type `u8` but type `u32` was found
    --> src/main.leo:5:21
     |
   5 |         let z: u8 = x + y;
     |                     ^

collinc97 avatar Jan 05 '23 22:01 collinc97