Multiline string literals shift source-line identities and make temporal queries return the wrong value
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 82/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C
- Stars
- 3
- Forks
- 7
- Avg merge
- 3h 58m
- Merged PRs (30d)
- 105
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from InauguralSystems/EigenScript
-
area:lint-tooling bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
InauguralSystems/EigenScript#1340 ·
Maintainers usually reply within 1 day
-
area:stdlib found-by:code-review kind:silent-wrong
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
InauguralSystems/EigenScript#1338 ·
Maintainers usually reply within 1 day
-
area:lint-tooling found-by:critic kind:docs-drift
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
InauguralSystems/EigenScript#1335 ·
Maintainers usually reply within 1 day
-
area:ci found-by:critic kind:gate-defect
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
InauguralSystems/EigenScript#1311 ·
Maintainers usually reply within 1 day
-
enrolment: decide test_gc_runner_controls.py (exempt vs enrol) and whether floors need a ratchetOpenarea:gates found-by:critic kind:decision
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
InauguralSystems/EigenScript#1280 · 1 comment ·
Maintainers usually reply within 1 day
All issues in InauguralSystems/EigenScript
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
ClickHouse/pg_clickhouse#383 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
johnsonjh/emu2-cpm86#68 · 1 comment ·
Maintainers usually reply within 1 day
-
Zenmap CrashOpenZenmap
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
BasedHardware/omi#19306 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
fastfetch-cli/fastfetch#2619 ·
Maintainers usually reply within 1 day