Граф коммитов

2 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 88c276e0aa [tests][generator] Port XI/Classic tests to XI/Unified. (#1745)
* [tests][generator] Port XI/Classic tests to XI/Unified.

* [tests][generator] Comment out code triggering previously unknown bugs.

These tests makes the generator fail:

    error BI0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
    System.NullReferenceException: Object reference not set to an instance of an object
      at Generator.GetSetterExportAttribute (System.Reflection.PropertyInfo pinfo) [0x0002e] in /work/maccore/master/xamarin-macios/src/generator.cs:1981
      at Generator.Go () [0x007e3] in /work/maccore/master/xamarin-macios/src/generator.cs:2162
      at BindingTouch.Main2 (System.String[] args) [0x010b2] in /work/maccore/master/xamarin-macios/src/btouch.cs:435
      at BindingTouch.Main (System.String[] args) [0x0001d] in /work/maccore/master/xamarin-macios/src/btouch.cs:77
      at System.Environment.get_StackTrace () [0x00000] in /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/Environment.cs:321
      at ErrorHelper.ShowInternal (System.Exception e) [0x000dc] in /work/maccore/master/xamarin-macios/src/error.cs:200
      at ErrorHelper.Show (System.Exception e) [0x00027] in /work/maccore/master/xamarin-macios/src/error.cs:151
      at BindingTouch.Main (System.String[] args) [0x0002b] in /work/maccore/master/xamarin-macios/src/btouch.cs:79

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52664.

* [tests][generator] Comment out code triggering previously unknown bugs.

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52665.
2017-02-22 16:47:11 +01:00
Sebastien Pouliot e55385637f [generator] Allow identical (numeric) values in smart enums. Fixes #46285 (#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
2016-11-02 21:46:04 -04:00