Commit f0a79a0
authored
fix: preserve leading nil in stab clause body (#120)
A -> clause body can begin with a semicolon token after optional
newlines, and that semicolon represents an implicit leading nil
expression in the clause rhs.
The previous detection logic did not recognize the `-> \n;expr` shape
reliably, so the resulting AST dropped that leading nil and diverged
from Code.string_to_quoted/2 output in with ... else clauses.
This change detects the leading semicolon by peeking past end-of-line
trivia before consuming clause eoe tokens, preserving the expected rhs
shape.
A regression assertion was added to `property test regression cases` for
`with x <- 1 do :ok else _ -> \n;a end` to prevent this AST mismatch
from returning.
fix #1131 parent c7ce8e0 commit f0a79a0
2 files changed
Lines changed: 7 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1220 | 1201 | | |
1221 | 1202 | | |
1222 | 1203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2301 | 2301 | | |
2302 | 2302 | | |
2303 | 2303 | | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
2304 | 2308 | | |
2305 | 2309 | | |
2306 | 2310 | | |
| |||
0 commit comments