Description
Tooling asked us to (potentially optionally) include all comments in the AST for being able to support pretty-printing ASTs to near-identical sources (except whitespace differences, accounting for which would definitely go too far).
There's related discussion already in e.g. #4559.
We'll need to weigh the complexity this would induce for scanning and parsing and check if this can be done in a reasonable amount of time (since this is non-critical).
We can consider removing comments on the expression level from the scope of this, since they may be a larger hassle than comments on the statement level.
We'd also need to decide whether to introduce full AST nodes (maybe that'd be the way to go for statement-level comments) or fields similar to the documentation
field used for natspac comments (that may be the only choice for comments on the expression level, if we even consider those).
Some justification for spending time on this otherwise tangential issue is that we could use such comments for testing AST-based properties like the annotations produced by #13378 in isoltest
by introducing special comments with test expectations. In that sense, this weakly relates to our roadmap task #13722
Metadata
Metadata
Assignees
Labels
Type
Projects
Status