[Bug]: Swift: a local with same name as a modifier (prefix, open, final...) used in a switch case body gives a syntax-parse error from tree-sitter-swift
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- developer-experience, tooling
Línea de trabajo
El issue menciona extract.py, la parametrización de las pruebas de Swift y el changelog. Lee el tratamiento existente de los identificadores con nombres de modificadores y ejecuta los dos archivos de pruebas de Swift mencionados en el issue. El trabajo está terminado cuando se analicen las expresiones switch-case cubiertas, se incluyan los seis nombres adicionales y esas pruebas pasen; las excepciones enumeradas permanecen sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Pre-flight checks
- I have checked the Troubleshooting section in the README
What happened?
Summary:
tree-sitter-swift 0.7.4 cannot parse a local value whose name is a Swift contextual modifier when it is used as return name <operator> or return name.member inside a switch case. The grammar reads the identifier as a declaration modifier waiting for a declaration, and the surrounding code collapses into ERROR nodes. Graphify warns about a syntax-parse error at line: X and extracts the file only partially.
Related but distinct: #3540 (another tree-sitter-swift parse failure, if let x = await ...).
The trigger is a modifier-named identifier at the start of an expression statement inside a case body, followed by an operator or member access.
Limits and unfixed exceptions (the fix doesn't cover these, so behavior is unchanged: partial extraction plus the warning):
- A function parameter named like a modifier. Renaming it would change the argument label and every call site.
- A closure parameter, as in
xs.map { prefix in ... }. - Tuple destructuring, as in
let (prefix, b) = t. - A file with any other syntax error, because the rewrite is accepted only if the whole file then parses cleanly.
- Names I haven't tested. The list is only what I verified.
Covered: if let prefix = x, and a type-scope property with the same name.
Code change: added six names that also fail to extract.py, the test parametrization, and the changelog: distributed, nonmutating, public, private, internal and fileprivate.
Validation: The Swift tests pass, 36 of 36 in the two files I re-ran after the change. I did not re-run the full suite because it had 8 failures before this change, and they also fail without this fix.
static, class and inout also error, but they are reserved keywords, so let class = 1 isn't valid Swift.
Steps to reproduce
Minimal repro
let prefix = "x"
switch kind {
case 0:
return prefix + "a" // error
| Case body | Result |
|---|---|
return prefix + "a" |
error |
return prefix.count > 0 ? "a" : "b" |
error |
return prefix |
ok |
print(prefix) |
ok |
let y = prefix |
ok |
x = prefix + "a" |
ok |
return "a" + prefix |
ok |
return pfx + "a" (local renamed) |
ok |
return prefix + "a" inside if k == 0 { ... } instead of a switch |
ok |
return prefix + "a" after the switch, outside any case |
ok |
Error output or graph output
codefile.swift had a syntax-parse error at line X, so its extraction may be partial (Y symbols found).
Graphify version
0.9.102
Operating System
macOS
Python Version
3.13
Installation Method
uv tool install (recommended)
Additional Environment Details
No response
Additional context
No response
- Lenguaje dominante
- Python
- Estrellas
- 124k
- Forks
- 11.9k
- Merge medio
- 2 h 35 min
- PR fusionados (30 d)
- 6
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Graphify-Labs/graphify
-
[Bug]: valid JSON with the wrong global-manifest shape bypasses recoveryPosiblemente ocupada @azizur100389 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Graphify-Labs/graphify#5020 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug]: malformed learning sidecar data can hide valid annotationsPosiblemente ocupada @azizur100389 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Graphify-Labs/graphify#5019 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug]: graphify update skips or partially rebuilds a missing graph when the manifest survivesPosiblemente ocupada @azizur100389 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Graphify-Labs/graphify#5016 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Graphify-Labs/graphify#4831 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Posiblemente ocupada @Deepjyoti-Sarmah la tomó hace 19 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Graphify-Labs/graphify#4563 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de Graphify-Labs/graphify
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
[Bug] vllm-sr config migrate drops providers.models[].deploymentPosiblemente ocupada @Bevisy la tomó hoy. Abiertoneeds-acceptance wg/developer-experience-ecosystem
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
vllm-project/semantic-router#5996 ·
Los mantenedores suelen responder en 2 días
-
bugfix low-priority plugin:abstract plugin:leyline small-effort source:discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
athola/claude-night-market#1132 ·
-
Add support for Sinhala languageAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
WeblateOrg/language-data#2773 ·
Los mantenedores suelen responder en 1 día
-
[yugabyted] xcluster set_up and add_to_replication fail for database names containing - . or (Abiertokind/bug priority/medium qa_automation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
yugabyte/yugabyte-db#37324 ·
Los mantenedores suelen responder en 1 día