Skip to content

Nullable semantic model mishandles argument conversion types #35012

@333fred

Description

@333fred

See IdentityConversion_NullCoalescingOepration_02. ApplyArgumentConversion is applying the result of the conversion to the underlying BoundNullCoalescingOperator, which isn't what was intended. Original text of the affected part of the test is below.

    static void F1(IIn<object>? x1, IIn<object?>? y1)
    {
        FIn((x1 ?? y1)/*T:IIn<object!>?*/); // This is returning IIn<object?>?
        FIn((y1 ?? x1)/*T:IIn<object!>?*/); // This is returning IIn<object?>?
    }

    static void F3(object? x3, object? y3)
    {
        FIn((FIn(x3) ?? FIn(y3))/*T:IIn<object?>?*/); // A
        if (x3 == null) return;
        FIn((FIn(x3) ?? FIn(y3))/*T:IIn<object!>?*/); // B
        FIn((FIn(y3) ?? FIn(x3))/*T:IIn<object!>?*/); // C
        if (y3 == null) return;
        FIn((FIn(x3) ?? FIn(y3))/*T:IIn<object!>?*/); // D
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions