verichains / revela

Decompiler for Move smart contracts
https://revela.verichains.io
Other
43 stars 10 forks source link

Missing parentheses in cast #1

Open Kripth opened 6 months ago

Kripth commented 6 months ago

When decompiling a cast it seems that the outer parentheses are optimised away.

Example:

fun test(a: u64): u256 {
    (a as u256)
}

// decompiles to
fun test(arg0: u64) : u256 {
    arg0 as u256
}

When a cast is not the outer operator it is decompiled correctly:

fun test(a: u64): u256 {
    ((a as u128) as u256)
}

// decompiles to
fun test(arg0: u64) : u256 {
    (arg0 as u128) as u256
}
aquynh commented 6 months ago

thanks for the bug report. do you want to make a PR to fix this?

aquynh commented 6 months ago

fixed in the "dev" branch now, can you confirm?