Skip to content

Interface inheritance and duplicate fields #58

@jakubfijalkowski

Description

@jakubfijalkowski

Since we support inheritance on the C# side, but want to convert it to "extension", we need to prevent the following case:

interface A { int PropA { get; set; } }
interface B { int PropA { get; set; } }
class C : A, B { public int PropA { get; set; } }

Currently, both A and B will have PropA. C won't, but it will extend both A and B and the resulting type will need to support both. That is wrong as we don't really know which PropA we are talking about. And if these two differ in type, e.g. when they are done like this:

interface A { int PropA { get; set; } }
interface B { string PropA { get; set; } }
class C : A, B { int A.PropA { get; set; } string B.PropA { get; set; } }

or like that

interface A { int PropA { get; set; } }
interface B { string PropA { get; set; } }
class M : A { public int PropA { get; set; } }
class C : M, B { new public string PropA { get; set; } }

we have totally undecidable case.

I suggest blocking this - i.e. when any DTO has a duplicate property when "flattened", reject it. What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions