unoplatform / Uno.CodeGen

A set of source generators for equality, immutability, ...
Other
90 stars 11 forks source link

B.Builder() from class B returns a class A object when B inherit from A #131

Open YGuerin opened 4 years ago

YGuerin commented 4 years ago

I'm submitting a...

Current behavior

B.Builder() from class B returns a class A object when B inherit from A

Expected behavior

B.Builder() from class B returns a class B object when B inherit from A

Minimal reproduction of the problem with instructions

Class A

[GeneratedImmutable]
public partial class ClassA
{
    [... some properties ...]
}

Class B

[GeneratedImmutable]
public partial class ClassB : ClassA
{
    [... some properties ...]
}

And call this wherever you want

var test = new ClassB.Builder()
    .WithPropertyFromClassA(...)
    .WithPropertyFromClassB(....)
    .ToImmutable();

Doesn't work because ClassB.Builder() is returning a ClassA object

Environment

Nuget Package: 5.7.0

Package Version(s): Uno.UI 3.0.11 / Uno.CodeGen 1.32.0

Affected platform(s):
- [ X ] iOS
- [ X ] Android
- [ X ] WebAssembly
- [ X ] Windows
- [ ] Build tasks

Visual Studio
- [ X ] 2019 (version: 16.7.2 )
- [ ] 2017 (version: )
- [ ] 2017 Preview (version: )
- [ ] for Mac (version: )

Relevant plugins
- [ ] Resharper (version: )