Bug 46812 - iOS Binding Library: Protocol inline hides inherited member on lvl3 inheritance
Summary: iOS Binding Library: Protocol inline hides inherited member on lvl3 inheritance
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-11 17:47 UTC by Flash3001
Modified: 2017-02-15 22:30 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (5.10 KB, application/zip)
2017-02-15 22:29 UTC, Alex Soto [MSFT]
Details

Description Flash3001 2016-11-11 17:47:07 UTC
I've posted it on Forums, but got no answer. https://forums.xamarin.com/discussion/72120/protocol-inline-hides-inherited-member-on-lvl3-inheritance#latest

I seems to be a bug, not a feature. So posting here as well. 

Given the following definition:

------------BEGIN CODE----------------

[Protocol, Model]
interface Data1
{
  [Abstract]
  [Export("Info")]
  int Info { get; }
}

[BaseType(typeof(NSObject))]
interface ProviderLvl1 : Data1
{
    [Export("Info")]
    int Info { get; set; }
}

[Protocol, Model]
interface Data2 : Data1 { }


[BaseType(typeof(ProviderLvl1))]
interface ProviderLvl2 : Data2 { }

[Protocol, Model]
interface Data3 : Data2 { }


[BaseType(typeof(ProviderLvl2))]
interface ProviderLvl3 : Data3 { }

-------------END CODE-----------------

The result is: 

------------BEGIN CODE----------------

    [Protocol (Name = "Data1", WrapperType = typeof(Data1Wrapper)), ProtocolMember (IsRequired = true, IsProperty = true,    IsStatic = false, Name = "Info", Selector = "Info", PropertyType = typeof(int), GetterSelector = "Info", ArgumentSemantic = ArgumentSemantic.None)]
    public interface IData1 : INativeObject, IDisposable
    {
        [Preserve (Conditional = true)]
        int Info {
            [Export ("Info")]
            get;
        }
    }

    [Register ("ProviderLvl1", true)]
    public class ProviderLvl1 : NSObject, IData1, INativeObject, IDisposable
    {
        ... 
        [CompilerGenerated]
        public virtual int Info {
            [Export ("Info")]
            get;
            [Export ("setInfo:")]
            set;
        }
        ...
    }

    [Protocol (Name = "Data2", WrapperType = typeof(Data2Wrapper))]
    public interface IData2 : INativeObject, IDisposable, IData1
    {
    }

    [Register ("ProviderLvl2", true)]
    public class ProviderLvl2 : ProviderLvl1, IData1, IData2, INativeObject, IDisposable
    {
        ...
    }

    [Protocol (Name = "Data3", WrapperType = typeof(Data3Wrapper))]
    public interface IData3 : INativeObject, IDisposable, IData1, IData2
    {
    }

// So far it's all OK. The problem is now:

    [Register ("ProviderLvl3", true)]
    public class ProviderLvl3 : ProviderLvl2, IData1, IData2, IData3, INativeObject, IDisposable
    {
        ...
        [CompilerGenerated]
        public new virtual int Info {
            [Export ("Info")]
            get;
        }
        ...
    }

-------------END CODE-----------------

Data1 protocol is inlined in ProviderLvl1 as expected. Data2 protocol isn't inlined in ProviderLvl2 as its members already exists. But Data3 protocol gets inlined in ProviderLvl3, behaving differently from Data2 protocol.
Comment 1 Flash3001 2016-11-11 17:54:18 UTC
Xamarin.iOS
Version: 10.2.0.4 (Xamarin Studio Community)
Hash: b638977
Branch: xcode8.1
Build date: 2016-10-25 14:38:48-0400
Comment 2 Alex Soto [MSFT] 2017-02-15 22:29:54 UTC
Created attachment 19835 [details]
Test Case

Note You need to log in before you can comment on or make changes to this bug.