-
Notifications
You must be signed in to change notification settings - Fork 520
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
[generator] Backport smart enum fixes from master #1105
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows us to convert some existing manual conversion code into generated code and never miss a new constant being added [1]. The additional control comes in two forms: * allow [Field (null)]: a null NSString constant will return this enum value instead of throwing an ArgumentNullException; * a new `[DefaultEnumValue]` attribute allow marking the constant to be returned if the enum value is not known; [1] Vincent found some missing in HomeKit when adding the new ones from iOS 10. This commits also adds documentation for the existing (missing) and new attributes.
…6285 (dotnet#1102) Considering the following binding code: public enum HMAccessoryCategoryType { [Field ("HMAccessoryCategoryTypeGarageDoorOpener")] DoorOpener, GarageDoorOpener = DoorOpener, } We must 1. Ensure that `HMAccessoryCategoryType.DoorOpener.GetConstant () == HMAccessoryCategoryType.GarageDoorOpener.GetConstant ()`; This is done by using the numeric value of the enum member (instead of the name) 2. Ensure that `HMAccessoryCategoryTypeExtensions.GetValue ("HMAccessoryCategoryTypeGarageDoorOpener")` always return the same enum value, i.e. it can **not** change between XI versions (e.g. due to reflection ordering) as it could break comparison code; This is done by only adding a map to the member that has a [Field] and means that: 2.1. the _favorite_ enum member should be the one with the [Field]; and 2.2. a [Field] value can only be used once per enum (or else we report an BI1046 error). This also solve the duplicate code generation for the constant loading code; Reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=46285
…otnet#1104) Covers attributes on the type itself and on its members. Reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=46292
Build success |
spouliot
added a commit
to spouliot/xamarin-macios
that referenced
this pull request
Nov 6, 2018
Commit list for xamarin/Xamarin.MacDev: * dotnet/macios-devtools@49a17b1 VSTS 702327: Launch image sizes for iPhone XS Max and iPhone XR (dotnet#35) * dotnet/macios-devtools@95599c5 Added new Xcode10 Watch Complication values (dotnet#34) * dotnet/macios-devtools@59b15be Use Version.TryParse * dotnet/macios-devtools@2dd5fa0 Merge pull request dotnet#32 from xamarin/vsts-692176 * dotnet/macios-devtools@a97390f VSTS-692176: Add missing AutoFill Credential Provider entitlement * dotnet/macios-devtools@19b14f6 Added API to get the recommended Xcode version value Diff: dotnet/macios-devtools@39ea45b...49a17b1 Commit list for mono/mono: * mono/mono@4d7b7ab3751 [ci] Fix Windows .msi build * mono/mono@21dc7470bc7 [bcl] avoid false pinning in GCTest (dotnet#11534) * mono/mono@d9779c1df6d [interp] accept typed-by-ref as return type from a JIT call (dotnet#11538) * mono/mono@e7e14a79297 [interp] transform delegate invoke in method body too (dotnet#11549) * mono/mono@cadeaf43dad [ci] Switch to new syntax of Azure Storage plugin Diff: mono/mono@709b46e...4d7b7ab Commit list for xamarin/maccore: * xamarin/maccore@e73094e632 Update maciostools to head (dotnet#1117) * xamarin/maccore@4902ebbdbd Merge pull request dotnet#1105 from xamarin/swift-o-matic-optional-virtual-constructor * xamarin/maccore@76ecea4760 Added IsOptional property. * xamarin/maccore@77d93295bd Added a test where the init fails to ensure both paths work. * xamarin/maccore@3d989b1ca4 Support for optional constructors in virtual classes. * xamarin/maccore@bfdc782d0e Merge pull request dotnet#1100 from xamarin/swift-o-matic-constructor-mulligan * xamarin/maccore@cf8025724d Added field and prop for ClassHandle * xamarin/maccore@dc2e3f32fe Trimmed down ObjC constructors. * xamarin/maccore@b53827c151 [SoM] Document CI a bit. (dotnet#1101) * xamarin/maccore@46d01c8c10 [SoM] Provision XI and Mono as well. (dotnet#1099) * xamarin/maccore@b4455eafcb bye bye old code. * xamarin/maccore@34730dfeac Lots of changes for constructor refactoring. * xamarin/maccore@bd09006725 Merge pull request dotnet#1096 from xamarin/swift-o-matic-required-init * xamarin/maccore@2af91dc79a Label those asserts! * xamarin/maccore@ea5b501a47 It looks like cmake isn't there? * xamarin/maccore@b50285719f Support for required init methods * xamarin/maccore@6e7187da41 [install-qa-provisioning-profiles] Create directory before trying to create files in it. (dotnet#1095) * xamarin/maccore@8addb4a338 Merge pull request dotnet#1092 from xamarin/swift-o-matic-objc-methods * xamarin/maccore@9dc7111497 Removed dead code, added nfloat. * xamarin/maccore@663279065d Removed dead code. * xamarin/maccore@3852918abc Added code to import C# methods defined in ObjC bindings. Diff: https://github.com/xamarin/maccore/compare/b35c3a8d7682c8482c7c749d7c1670b3d4bbed5c...e73094e6322531bcefdef95b4ec8654f596c4ae9
spouliot
added a commit
that referenced
this pull request
Nov 6, 2018
Commit list for xamarin/Xamarin.MacDev: * dotnet/macios-devtools@49a17b1 VSTS 702327: Launch image sizes for iPhone XS Max and iPhone XR (#35) * dotnet/macios-devtools@95599c5 Added new Xcode10 Watch Complication values (#34) * dotnet/macios-devtools@59b15be Use Version.TryParse * dotnet/macios-devtools@2dd5fa0 Merge pull request #32 from xamarin/vsts-692176 * dotnet/macios-devtools@a97390f VSTS-692176: Add missing AutoFill Credential Provider entitlement * dotnet/macios-devtools@19b14f6 Added API to get the recommended Xcode version value Diff: dotnet/macios-devtools@39ea45b...49a17b1 Commit list for mono/mono: * mono/mono@4d7b7ab3751 [ci] Fix Windows .msi build * mono/mono@21dc7470bc7 [bcl] avoid false pinning in GCTest (#11534) * mono/mono@d9779c1df6d [interp] accept typed-by-ref as return type from a JIT call (#11538) * mono/mono@e7e14a79297 [interp] transform delegate invoke in method body too (#11549) * mono/mono@cadeaf43dad [ci] Switch to new syntax of Azure Storage plugin Diff: mono/mono@709b46e...4d7b7ab Commit list for xamarin/maccore: * xamarin/maccore@e73094e632 Update maciostools to head (#1117) * xamarin/maccore@4902ebbdbd Merge pull request #1105 from xamarin/swift-o-matic-optional-virtual-constructor * xamarin/maccore@76ecea4760 Added IsOptional property. * xamarin/maccore@77d93295bd Added a test where the init fails to ensure both paths work. * xamarin/maccore@3d989b1ca4 Support for optional constructors in virtual classes. * xamarin/maccore@bfdc782d0e Merge pull request #1100 from xamarin/swift-o-matic-constructor-mulligan * xamarin/maccore@cf8025724d Added field and prop for ClassHandle * xamarin/maccore@dc2e3f32fe Trimmed down ObjC constructors. * xamarin/maccore@b53827c151 [SoM] Document CI a bit. (#1101) * xamarin/maccore@46d01c8c10 [SoM] Provision XI and Mono as well. (#1099) * xamarin/maccore@b4455eafcb bye bye old code. * xamarin/maccore@34730dfeac Lots of changes for constructor refactoring. * xamarin/maccore@bd09006725 Merge pull request #1096 from xamarin/swift-o-matic-required-init * xamarin/maccore@2af91dc79a Label those asserts! * xamarin/maccore@ea5b501a47 It looks like cmake isn't there? * xamarin/maccore@b50285719f Support for required init methods * xamarin/maccore@6e7187da41 [install-qa-provisioning-profiles] Create directory before trying to create files in it. (#1095) * xamarin/maccore@8addb4a338 Merge pull request #1092 from xamarin/swift-o-matic-objc-methods * xamarin/maccore@9dc7111497 Removed dead code, added nfloat. * xamarin/maccore@663279065d Removed dead code. * xamarin/maccore@3852918abc Added code to import C# methods defined in ObjC bindings. Diff: https://github.com/xamarin/maccore/compare/b35c3a8d7682c8482c7c749d7c1670b3d4bbed5c...e73094e6322531bcefdef95b4ec8654f596c4ae9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.