Formatter collapses unequal legal indentation levels and emits unparseable source
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C
- スター
- 3
- フォーク
- 7
- 平均マージ
- 3時間 58分
- マージ済み PR(30日)
- 105
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InauguralSystems/EigenScript のほかの issue
-
area:lint-tooling bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
InauguralSystems/EigenScript#1340 ·
メンテナーはふだん 1 日以内に返信
-
area:stdlib found-by:code-review kind:silent-wrong
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
InauguralSystems/EigenScript#1338 ·
メンテナーはふだん 1 日以内に返信
-
area:lint-tooling found-by:critic kind:docs-drift
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
InauguralSystems/EigenScript#1335 ·
メンテナーはふだん 1 日以内に返信
-
area:ci found-by:critic kind:gate-defect
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
InauguralSystems/EigenScript#1311 ·
メンテナーはふだん 1 日以内に返信
-
enrolment: decide test_gc_runner_controls.py (exempt vs enrol) and whether floors need a ratchetオープンarea:gates found-by:critic kind:decision
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
InauguralSystems/EigenScript#1280 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
InauguralSystems/EigenScript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
NabuCasa/silabs-firmware-builder#231 · コメント 1 件 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
ClickHouse/pg_clickhouse#383 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信