Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert language-specific option types to records #66633

Merged
merged 10 commits into from
Feb 5, 2023
Merged

Conversation

tmat
Copy link
Member

@tmat tmat commented Feb 1, 2023

We have a few option types that have a common base class and then C# and VB specific derived classes containing the language-specific settings. Ideally, all these types would be records. However, it is not currently possible to derive from C# record in VB.

We also eventually want some of these types to be public and thus have a good public surface and usability (e.g. being able to use with operator to get an updated options object).

To work around the VB limitation this change defines the VB type in common layer, in the same namespace it would have been defined in the VB layer if VB allowed the definition to exist there.

This wart seems like a reasonable trade-off, considering the alternative would be to hand-write (or source-generate) a lot of WithXyz methods, GetHashCode, Equals, etc.

Each commit can be reviewed separately.

@tmat tmat requested a review from a team as a code owner February 1, 2023 02:37
Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

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

seems reasonable

@tmat tmat merged commit ce20bca into dotnet:main Feb 5, 2023
@ghost ghost added this to the Next milestone Feb 5, 2023
@tmat tmat deleted the SharedOptions branch February 5, 2023 00:31
333fred added a commit to 333fred/roslyn that referenced this pull request Feb 6, 2023
* upstream/main: (547 commits)
  Add VerifyMethodBody helper as a replacement of VerifyIL (dotnet#66536)
  don't offer rename for ctor snippet (dotnet#66704)
  Get `ConditionalAttribute` type only once per compilation
  Convert language-specific option types to records (dotnet#66633)
  Enable MSBuild COMM log (dotnet#66708)
  ⚡️Share AssemblyloadTestFixture on Framework (dotnet#66684)
  NRT
  Don't overwrite binary logs in CI (dotnet#66683)
  Fix 'Generate Enum Member' to work in a 'Color Color' case.
  Find bitwise operators accessed through logical operators in FAR
  Semantic snippets - `propg` and `propi` snippets (dotnet#65979)
  NRT
  Properly classify aliases in quick info
  Fix
  Add tests
  Add support for finding collection initialiers with FAR
  Do not suggest replacing lambda with method group if the invoked mehod has `Conditional` attribute
  Revert "Record added node output states as new (dotnet#61575)" (dotnet#66696)
  Record added node output states as new (dotnet#61575)
  Fix formatting issue with convert-to-full-prop
  ...
@RikkiGibson RikkiGibson modified the milestones: Next, 17.6 P2 Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants