Formatter collapses unequal legal indentation levels and emits unparseable source
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 74/100
Línea de trabajo
Start with src/fmt.c:352–382 and docs/SPEC.md:69, then run the supplied indent.eigs commands after a fresh default make build. Exercise the reproducer and the listed unequal-increment, sibling, dedent, and 2-/4-space cases; done means formatted programs remain parseable, preserve execution output, and satisfy the stated regression checks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Formatting a valid nested block can collapse two different indentation levels and make the program fail to parse. --fmt returns success; --fmt --write would replace the working source with that result. The LSP formatting handler uses the same formatter.
Reproduction
Save this as indent.eigs. The two indented lines use four and six spaces, respectively:
if 1:
if 1:
print of 7
print of 9
eigenscript indent.eigs
eigenscript --fmt indent.eigs > formatted.eigs
eigenscript formatted.eigs
Original: exit 0, stdout 7\n9\n. Formatter: exit 0, but emits:
if 1:
if 1:
print of 7
print of 9
The result exits 1 with Parse error line 3:5: expected indent, got identifier ('print').
Cause and contract
docs/SPEC.md:69 requires consistent indentation within a block, not equal increments between blocks. The original program executes successfully.
src/fmt.c:352–382 finds the smallest positive indentation (4 here), then computes level = indents[i] / min_indent. Integer division maps both 4 and 6 to depth 1. Formatting needs to preserve the actual nesting/dedent structure instead of deriving it from one global width.
Regression acceptance
- Formatting the reproducer preserves successful execution and its exact output.
- Cover unequal indentation increments, sibling blocks, dedents, and ordinary 2-/4-space inputs.
- Assert parseability and output after applying the formatter; idempotence alone cannot detect this corruption.
Distinct from #729/#750, which address splitting operators and keeping the operator table synchronized.
Verification
Confirmed with a fresh default make build of b91768e23c5a874a64e76e4af9ab291e6aa49983 in a clean isolated worktree. The original, formatter, and transformed program were executed separately with inherited EIGS_* variables removed; exit status and output were captured for each.
- Lenguaje dominante
- C
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 4 h 7 min
- PR fusionados (30 d)
- 112
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InauguralSystems/EigenScript
-
area:embed kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1387 ·
Los mantenedores suelen responder en 1 día
-
area:stdlib kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
InauguralSystems/EigenScript#1378 ·
Los mantenedores suelen responder en 1 día
-
area:gates kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
InauguralSystems/EigenScript#1374 ·
Los mantenedores suelen responder en 1 día
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminalAbiertoarea:lint-tooling kind:silent-wrong
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
InauguralSystems/EigenScript#1373 ·
Los mantenedores suelen responder en 1 día
-
area:gates kind:docs-drift
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
InauguralSystems/EigenScript#1372 ·
Los mantenedores suelen responder en 1 día
Todos los issues de InauguralSystems/EigenScript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
[Issue]: Headers - vx_ext_amd.h does not compile as C (enum types used without the enum keyword)Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Qiskit/qiskit#17079 · 1 comentario ·
Los mantenedores suelen responder en 1 día