basilisque-framework / AutoImplementer

Automatically implements interfaces
Apache License 2.0
1 stars 1 forks source link

Double nullables #1

Closed Fasteroid closed 2 weeks ago

Fasteroid commented 2 weeks ago

Interfaces that use nullable fields don't seem to work correctly.

For instance, this interface...

    [AutoImplementInterface()]
    public interface ITest {
        public int NonNullable { get; set; }
        public int? Nullable   { get; set; }
    }

Gets turned into this code by the generator:

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Basilisque.AutoImplementer.CodeAnalysis", "0.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public partial class TestImpl
    {
        public int NonNullable { get; set; }

        public int?? Nullable { get; set; }
    }

The int?? should just be int? with one question mark.

Probably an easy fix—I'm gonna see if I can PR one within the next hour

astaerk commented 2 weeks ago

Hi, wow, didn't expect any activity for this in the current state :)

I also noticed that problem and already fixed that. Technically you were faster, but I only saw your PR right after I just pushed my fix. But as you wrote a test for that I will still look into your merge request. Thank you for providing that.