amber-lang / amber-lang/amber

[BUG] parse_expr macro fails if one of the parsings have failed

Aperta
#513 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug compiler
Lingua principale
Rust
Stelle
5.2k
Fork
145
Merge medio
5g 3h
PR unite (30g)
7

Descrizione

**Describe the bug**
see [#504](https://github.com/amber-lang/amber/pull/504/commits/1f2d53f9a00a24b8304aa1078071b2df8f06060e#r1800614294)

**To Reproduce**
it is an internal compiler bug, which doesn't happen in normal amber use case.

let me explain:

there are multiple `ExprType`, and it parses the `Expr` with the `parse_expr` macro:
https://github.com/amber-lang/amber/blob/cd0338af4431c00cae51a64f6650c8a7ac62b10f/src/modules/expression/expr.rs#L135-L160

and the `parse_expr` fails if one of the parsings have failed, as an example what happened in #504 - the VariableGet parsing failed, and it didn't get to try to parse Len.

**Expected behavior**
for it to parse all of them until at least one `Ok`

**Additional context**
its a rather sneaky issue because its hard to undestand what is the problem here. maybe i don't understand how it works, since i didnt even look at the macro source code - it looks like machine code to me.

i think @Ph0enixKM is literally the only person who actually understands how macros work, so please do comment

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.