microsoft / microsoft/TypeScript
Trivia ownership documentation seems to be incorrect
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
Referencing the #1678 issue and the ast-trivia: trivia ownership in the typescript-book, there seems to be an error in explanation:
in the issue @mhegazy mentions:
one thing that is different from the Roslyn notion of trivia, is we do not have trailing trivia. all triva in TypeScript is leading. so for instance [...]
in the same issue and in the wiki book however the following info is given:
In General:
- A token owns any trivia after it on the same line upto the next token.
- Any comment after that line is associated with the following token.
So from the first cite I understand as if token owns any trivia before it up to the previous token ([trivia of A][token A]... that's why end-of-file token is always present) which seems to be the correct explanation, while the second cite describes that a token owns the trivia after it up to next token in the same line, which would mean that A has trailing trivia, thus not true in TS — albeit true for Roslyn.
[token A][trivia owned by A]<nl>
[trivia owned by B]
[token B]
Unless there is some misconception of what "owned" trivia means, but imo the second cite is incorrect.
Guía de contribución
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.
Línea de trabajo
Abre docs/compiler/ast-trivia.md en la sección “trivia ownership” y compara su redacción con el issue #1678 y el comportamiento de TypeScript citado. Actualiza la explicación para que la propiedad sea coherente con el modelo de trivia inicial descrito en el issue y, después, verifica que los ejemplos incluidos ya no impliquen trivia final.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 48/100