amber-lang / amber-lang/amber

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

Aberta
#513 1 comentário 0 reações 0 responsáveis Ver no GitHub
bug compiler
Linguagem predominante
Rust
Estrelas
5.2k
Forks
145
Merge médio
5d 3h
PRs com merge (30d)
7

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.