Skip to content

[Decompiler Bug] Missing parenthesis when handling type casting #17185

@junxzm1990

Description

@junxzm1990

The decompiler decompiles the following code (ref: decompiler test case legacy-move-stdlib/fixed_point32.exp)

public fun ceil(self: FixedPoint32): u64 {
        let floored_num = floor(self) << 32;
        if (self.value == floored_num) {
            return floored_num >> 32
        };
        let val = ((floored_num as u128) + (1 << 32));
        (val >> 32 as u64)
    }

===>

public fun ceil(self: FixedPoint32): u64 {
        let _t1 = floor(self) << 32u8;
        if (*&(&self).value == _t1) return _t1 >> 32u8;
        (_t1 as u128) + 4294967296u128 >> 32u8 as u64
    }

(_t1 as u128) + 4294967296u128 >> 32u8 is not parenthesized, leading to recompilation errors.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions