Skip to content

Merge 'Unions' into main#82640

Merged
AlekseyTs merged 42 commits into
dotnet:mainfrom
AlekseyTs:Unions_30
Mar 7, 2026
Merged

Merge 'Unions' into main#82640
AlekseyTs merged 42 commits into
dotnet:mainfrom
AlekseyTs:Unions_30

Conversation

@AlekseyTs

@AlekseyTs AlekseyTs commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Championed proposal: dotnet/csharplang#9662
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/unions.md
Test plan: #81074

The last commit packs enum values

[jcouv notes:] This should make it into .NET 11 SDK Preview 3 and VS 2026 18.6

First commit is a change that hopefully could be shared with "Closed Hierarchies" feature.
- Null pattern for classes
- TryGetValue nullable analysis
Supporting:
- ```union <name> ... ```
Align implementation with recent design changes:
- Case types are not nullable types (constructor parameter types are
unwrapped)
- Default nullability of the `Value` property is no longer inferred from
constructors. Annotations on the property declaration itself are used as
for any regular property.
@AlekseyTs AlekseyTs requested a review from a team as a code owner March 5, 2026 20:48
@AlekseyTs AlekseyTs requested review from a team as code owners March 5, 2026 20:48

@jjonescz jjonescz left a comment

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.

last commit LGTM

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

Copy link
Copy Markdown
Contributor Author

@RikkiGibson, @jcouv, @dotnet/roslyn-compiler For a second review

@phil-allen-msft phil-allen-msft self-requested a review March 5, 2026 23:40
@AlekseyTs AlekseyTs merged commit 86763dd into dotnet:main Mar 7, 2026
30 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Mar 7, 2026
mich4xD pushed a commit to JohannesMoersch/Functional that referenced this pull request Mar 17, 2026
…n from

dotnet/roslyn#82640

Adding Custom roslyn compiler version via csp files

Adding performance benchmarks for difference between functional union, new version using native union, and just simple switch using native union
mich4xD pushed a commit to JohannesMoersch/Functional that referenced this pull request Mar 17, 2026
…n from

dotnet/roslyn#82640

Adding Custom roslyn compiler version via csp files

Adding performance benchmarks for difference between functional union, new version using native union, and just simple switch using native union
@jjonescz jjonescz modified the milestones: Next, 18.6 Mar 31, 2026
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.

6 participants