Multiline string literals shift source-line identities and make temporal queries return the wrong value
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 3
- Fork
- 7
- Merge trung bình
- 11 giờ 30 phút
- Pull request đã merge (30 ngày)
- 269
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InauguralSystems/EigenScript
-
area:docs kind:docs-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
InauguralSystems/EigenScript#1887 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
phase2: test_bitwise.eigs cites ctl.scan.* rows; the MAP's refusal controls are ctl.N8.refuse-*Đang mởarea:gates kind:docs-drift
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
InauguralSystems/EigenScript#1851 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gates area:gfx found-by:critic kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
InauguralSystems/EigenScript#1825 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atĐang mởarea:runtime-vm kind:silent-wrong
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
InauguralSystems/EigenScript#1748 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:gfx bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
InauguralSystems/EigenScript#1684 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của InauguralSystems/EigenScript
Issue tương tự
-
Add `CPC_TAKE_TILL_CHARS`Đang mởdifficulty: easy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
performance solver
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ChefKissInc/Inferno#319 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
FreeJoy-Team/FreeJoy#275 ·