Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Multiline string literals shift source-line identities and make temporal queries return the wrong value

Cerrado
#1,251 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c
Área
compilers

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area:observer area:runtime-vm bug found-by:code-review kind:silent-wrong

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 \n controls; 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.

Lenguaje dominante
C
Estrellas
3
Forks
7
Merge medio
4 h 5 min
PR fusionados (30 d)
116

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de InauguralSystems/EigenScript

Todos los issues de InauguralSystems/EigenScript

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.