Skip to content

Fix synthesized comment emission with comment flags - #64488

Draft
S.H Jeong (z0rimo) wants to merge 1 commit into
microsoft:mainfrom
z0rimo:fix/64453-synthetic-comments
Draft

S.H Jeong (z0rimo) wants to merge 1 commit into
microsoft:mainfrom
z0rimo:fix/64453-synthetic-comments

Conversation

@z0rimo

Copy link
Copy Markdown

Fixes #64453

This restores Strada-compatible synthesized comment emission behavior.

EFNoLeadingComments and EFNoTrailingComments now 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.

@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 28, 2026
}
}

func TestSynthesizedCommentsIgnoreNoCommentsEmitFlags(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only add unit tests when we really really have to. You should test this with a compiler test if possible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, it was an API based report, so...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there isn't something like that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't even have a Go API at the moment. So it's a bit of an odd ask, sort of

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EFNoLeadingComments suppresses synthesized leading comments in tsgo; Strada only suppresses source comments

2 participants