-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Make constructors private for parts of the ComInterfaceGenerator that should only be created from their static methods #101740
Make constructors private for parts of the ComInterfaceGenerator that should only be created from their static methods #101740
Conversation
Tagging subscribers to this area: @dotnet/interop-contrib |
Personally, I do prefer using records here as the constraints around record usage (and the I also see changing to manual equality as a bug farm. We introduced a few bugs in LibraryImport when we had a few custom equality implementations because we forgot to update them. I think if we want to limit the constructor scope, we can manually define the record properties and define the more-scoped constructor in the body of the record, and just not use the "primary constructor" feature of records (while still getting the rest of the features of records). |
…huster/runtime into ComGenUseClassesForPipeline
…seClassesForPipeline
… should only be created from their static methods (dotnet#101740) Moves ComClassInfo to its own file and moves the Func that produces them in the ComClassGenerator pipeline to a static method on ComClassInfo. Makes the constructors for ComClassInfo, ComInterfaceContext, ComInterfaceInfo, and `ComMethoInfo private to enforce that they are only created from the static creation methods. Creates more static SpecialTypeInfo types for sbyte, uint, short, and ushort. Changes pattern matching on records to use property pattern matching rather than the deconstruction notation for records. Since the constructors are not accessible, neither are the deconstruct methods.
Part of #101615
Moves
ComClassInfo
to its own file and moves the Func that produces them in theComClassGenerator
pipeline to a static method onComClassInfo
.Makes the constructors for
ComClassInfo
,ComInterfaceContext
,ComInterfaceInfo
, and `ComMethoInfo private to enforce that they are only created from the static creation methods.Creates more static SpecialTypeInfo types for
sbyte
,uint
,short
, andushort
.Changes pattern matching on records to use property pattern matching rather than the deconstruction notation for records. Since the constructors are not accessible, neither are the deconstruct methods.