Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

  • Understand the issue: GlobalStatementSyntax lacks XML documentation comments
  • Identify the solution: Add TypeComment to Syntax.xml for GlobalStatementSyntax
  • Add XML documentation to GlobalStatementSyntax in Syntax.xml
  • Regenerate compiler code from Syntax.xml
  • Build and verify the changes
  • Review generated files to ensure documentation is present
  • Address code review feedback: Consolidate into summary to avoid duplicate remarks sections
  • Address review comment: Clarify that each top-level statement is wrapped in GlobalStatementSyntax
  • Remove broken link to top-level statements proposal
Original prompt

This section details on the original issue you should resolve

<issue_title>Need docs about GlobalStatementSyntax</issue_title>
<issue_description>As a user, how do I find out about the purpose of GlobalStatementSyntax? Is it documented anywhere?</issue_description>

<agent_instructions>Copilot. Please add a

section for GlobalStatementSyntax in Syntax.xml.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@tmat We also need a scripting specification.

Fixes #17118


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add documentation for GlobalStatementSyntax Add XML documentation for GlobalStatementSyntax Oct 14, 2025
Copilot AI requested a review from CyrusNajmabadi October 14, 2025 11:58
Copilot finished work on behalf of CyrusNajmabadi October 14, 2025 11:58
<Node Name="GlobalStatementSyntax" Base="MemberDeclarationSyntax">
<Kind Name="GlobalStatement"/>
<TypeComment>
<summary>Represents a global statement in a compilation unit. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi Oct 14, 2025

Choose a reason for hiding this comment

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

@copilot consider mentioning that each statement will be wrapped in a GlobalStatementSyntax at the top level. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit e0a8c9a. Added clarification that each statement at the top level of a compilation unit is wrapped in a GlobalStatementSyntax node.

Copilot AI requested a review from CyrusNajmabadi October 14, 2025 12:31
Copilot finished work on behalf of CyrusNajmabadi October 14, 2025 12:31
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review October 14, 2025 12:47
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner October 14, 2025 12:47
@CyrusNajmabadi
Copy link
Member

@dotnet/roslyn-compiler ptal.

@jcouv jcouv self-assigned this Oct 15, 2025
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (commit 4)

<Node Name="GlobalStatementSyntax" Base="MemberDeclarationSyntax">
<Kind Name="GlobalStatement"/>
<TypeComment>
<summary>Represents a global statement in a compilation unit. Each statement at the top level of a compilation unit is wrapped in a GlobalStatementSyntax node. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
Copy link
Member

Choose a reason for hiding this comment

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

This link 404s. Does it really need to be here in the first place?

public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken);
}

/// <summary>Represents a global statement in a compilation unit. Each statement at the top level of a compilation unit is wrapped in a GlobalStatementSyntax node. Global statements are top-level statements that can appear in a C# program or script. In regular C# programs (C# 9.0+), they are synthesized into a Main method. In C# scripts, they are executed as top-level code. See https://github.com/dotnet/csharplang/blob/main/proposals/top-level-statements.md for more information.</summary>
Copy link
Member

Choose a reason for hiding this comment

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

@copilot remove the final 'see' statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit 8f3e5d2. Removed the final 'see' statement with the link.

Copilot AI requested a review from CyrusNajmabadi October 16, 2025 11:07
Copilot finished work on behalf of CyrusNajmabadi October 16, 2025 11:07
@CyrusNajmabadi
Copy link
Member

@dotnet/roslyn-compiler ptal.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (commit 5)

@CyrusNajmabadi
Copy link
Member

@dotnet/roslyn-compiler for another pair of eyes.

@jcouv
Copy link
Member

jcouv commented Oct 22, 2025

@CyrusNajmabadi This looks ready to merg

@CyrusNajmabadi CyrusNajmabadi merged commit 6ad7a4f into main Oct 22, 2025
24 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 22, 2025
@CyrusNajmabadi CyrusNajmabadi deleted the copilot/add-globalstatementsyntax-docs branch October 23, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need docs about GlobalStatementSyntax

4 participants