ProvableHQ / leo

🦁 The Leo Programming Language. A Programming Language for Formally Verified, Zero-Knowledge Applications
https://leo-lang.org/
GNU General Public License v3.0
4.79k stars 655 forks source link

[Bug] compiler panic with assignment in else block #28370

Open mikebenfield opened 2 hours ago

mikebenfield commented 2 hours ago

🐛 Bug Report

This program:

program public_ttt.aleo {
    transition f(a: u8, b: u8) {
        if false {
            a = 255u8;
        } else {
            b = 255u8;
        }
    }
}

leo build results in a compiler panic

thread `main` panicked at compiler/passes/src/static_single_assignment/rename_statement.rs:181:29:
internal error: entered unreachable code: Type checking guarantees that all expressions have a type.