Skip to content

Add ITypeSymbol.UnionCaseTypes property - #84707

Merged
AlekseyTs merged 1 commit into
dotnet:mainfrom
AlekseyTs:Issue_84700
Jul 31, 2026
Merged

Add ITypeSymbol.UnionCaseTypes property#84707
AlekseyTs merged 1 commit into
dotnet:mainfrom
AlekseyTs:Issue_84700

Conversation

@AlekseyTs

@AlekseyTs AlekseyTs commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Related to #84700.

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings July 30, 2026 17:28
@AlekseyTs
AlekseyTs requested review from a team as code owners July 30, 2026 17:28
@AlekseyTs
AlekseyTs requested a review from a team as a code owner July 30, 2026 17:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added VSCode Needs API Review Needs to be reviewed by the API review council labels Jul 30, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

This PR modifies public API files. Please follow the instructions at https://github.com/dotnet/roslyn/blob/main/docs/contributing/API%20Review%20Process.md for ensuring all public APIs are reviewed before merging.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new experimental Roslyn public API surface for unions by exposing union case types via ITypeSymbol.UnionCaseTypes, and wires it through the C# public model, VB implementation, and symbol wrappers, with baseline and test updates.

Changes:

  • Introduces ITypeSymbol.UnionCaseTypes (experimental) returning an empty array when the type is not a union.
  • Implements the new property in C# public symbols and VB symbols (VB returns empty since VB doesn’t support unions), plus forwards through metadata-as-source wrappers and code-generation symbols.
  • Updates PublicAPI + SemanticSearch API lists and adds initial unit test coverage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs Adds default UnionCaseTypes implementation for codegen symbols.
src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.txt Updates semantic-search reference API list to include the new getter.
src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs Forwards UnionCaseTypes through the wrapped symbol.
src/Compilers/VisualBasic/Portable/Symbols/TypeSymbol.vb Implements ITypeSymbol.UnionCaseTypes as empty (VB has no unions).
src/Compilers/CSharp/Test/CSharp15/UnionsTests.cs Adds tests for the public API shape (basic union + non-union + VB view).
src/Compilers/CSharp/Portable/Symbols/PublicModel/TypeSymbol.cs Implements ITypeSymbol.UnionCaseTypes for C# public symbols using UnionCaseTypesNoUseSiteDiagnostics.
src/Compilers/Core/Portable/Symbols/ITypeSymbol.cs Adds the new experimental UnionCaseTypes API with XML doc.
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt Registers the new experimental public API surface.

Comment thread src/Compilers/CSharp/Test/CSharp15/UnionsTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Feature - Unions Needs API Review Needs to be reviewed by the API review council VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants