Multiline string literals shift source-line identities and make temporal queries return the wrong value
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in src/lexer.c at the ordinary-string scanner around line 485 and the f-string literal scanner around line 455; compare their position handling with the source-line contracts in docs/SPEC.md. Run the listed multiline and escaped-newline reproducers, then add regression coverage for both string forms, multiple literal newlines, temporal queries, and caught runtime errors. Done means physical lines and error.line are correct while literal values and source spans remain unchanged.
索引モデルが issue の本文から書いたものです。
説明
Physical newlines inside a string literal do not advance the lexer's line counter. Later assignments are recorded under the wrong source lines, so temporal queries can return the wrong value with exit 0. Runtime error locations shift too. Ordinary strings and literal text in f-strings both exhibit the defect.
Reproduce
Save and run this exact five-line program:
s is "a
b"
x is 10
x is 20
print of (what is x at 3)
Actual: exit 0, stdout 20\n, empty stderr. Expected: 10\n; physical line 3 assigns 10.
Paired control: replace the first two physical lines with an escaped newline followed by a blank line. The assignments retain exactly the same physical line numbers:
s is "a\nb"
x is 10
x is 20
print of (what is x at 3)
The control exits 0 and prints 10\n. Prefixing either literal with f reproduces the same failure/control pair, so that sibling belongs in this fix.
A second reproducer keeps only the first two physical lines above, followed by:
try:
q is 1 / 0
catch e:
print of e.line
With the physical multiline literal, it prints 3; the division is on physical line 4. The escaped-newline/blank-line control prints 4. Both exit 0; the builtin error is caught.
Cause and contract
The ordinary-string scanner advances p and col through literal newlines without advancing line. The f-string literal scanner does the same. Tokens after the literal inherit this shifted position.
The spec explicitly defines at <line> as a source-line query and error.line as the 1-based source line. Fix physical position accounting while retaining string bytes and the token's opening position.
Regression acceptance
- Both ordinary-string and f-string reproducers return 10 at physical line 3.
- Caught runtime errors report their physical source line after these literals.
- Cover multiple literal newlines and escaped
\ncontrols; escapes must not advance the physical line counter. - Preserve the original literal values and source spans.
Distinct from #1245 (the formatter changes string contents) and #1244 (f-string interpolation token positions are discarded during splicing).
Verification
Confirmed on a fresh default release build of b91768e23c5a874a64e76e4af9ab291e6aa49983, with inherited EIGS_* variables cleared. Each reproducer and paired control was executed; no runtime or test source was changed. This is a current correctness defect, not a proposed v1 language restriction.
- 主要言語
- C
- スター
- 3
- フォーク
- 7
- 平均マージ
- 4時間 15分
- マージ済み PR(30日)
- 106
環境構築
このプロジェクトの開発コンテナを、あなたの 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時間 初心者へのやさしさ 88/100
ARM-software/sysarch-acs#556 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
netdata/netdata#24062 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100