Skip to content

[ICE] Ternary operator in let binding causes compiler crash #1133

@Subway2023

Description

@Subway2023

Fe version: 0.26.0
Description: When using a ternary operator (?:) inside a let binding, the Fe compiler crashes.

contract C {
    pub fn f(self, b: u256) -> u256 {
        require(b < 10);
        let c: u256 = b < 5 ? 5 : 1;  // ❌ This line triggers compiler crash
        let d: u256 = c > 5 ? 3 : 2;
        return d;
    }
}
thread 'main' panicked at crates/parser/src/lexer/token.rs:313:22:
internal error: entered unreachable code
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

You've hit an internal compiler error. This is a bug in the Fe compiler.
Fe is still under heavy development, and isn't yet ready for production use.

If you would, please report this bug at the following URL:
  https://github.com/ethereum/fe/issues/new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions