Fix synthesized comment emission with comment flags - #64488
S.H Jeong (z0rimo) wants to merge 1 commit into
Conversation
| } | ||
| } | ||
|
|
||
| func TestSynthesizedCommentsIgnoreNoCommentsEmitFlags(t *testing.T) { |
There was a problem hiding this comment.
We only add unit tests when we really really have to. You should test this with a compiler test if possible.
There was a problem hiding this comment.
Though, it was an API based report, so...
There was a problem hiding this comment.
Yeah, that was my concern as well. Since the behavior under test requires attaching synthesized comments through the emit/printer API, I couldn't find a source-only compiler test that exercises the same path.
I used the printer unit test here so it can explicitly combine a real source comment, the emit flag, and a synthesized replacement comment.
Happy to move this to a compiler test if there's an existing harness/path that can exercise that API behavior.
There was a problem hiding this comment.
No, there isn't something like that.
There was a problem hiding this comment.
We don't even have a Go API at the moment. So it's a bit of an odd ask, sort of
Fixes #64453
This restores Strada-compatible synthesized comment emission behavior.
EFNoLeadingCommentsandEFNoTrailingCommentsnow suppress only comments from the source text, while synthesized replacement comments continue to be emitted.Regression tests cover both leading and trailing comments, including
EFNoComments, and verify that source comments are suppressed while synthesized comments are preserved.