argotorg / argotorg/fe

[ICE] Ternary operator in let binding causes compiler crash

Open
#1,133 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 4h
Merged PRs (30d)
8

Description

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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the crash with the contract example, then inspect crates/parser/src/lexer/token.rs around line 313 and trace the token handling reached by the ternary expression in a let binding. Done means the example compiles without the reported internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.