Skip to content

Warning inferring nullability of lambda return type tuple #32006

@cston

Description

@cston
using System;

class Program
{
    static T F<T>(Func<bool, T> f)
    {
        return f(true);
    }

    static void G<T>(object x)
    {
        F(b =>
        {
            if (b) return (x, null); // warning
            return (x, x);
        });
    }
}
(14,27): warning CS8619: Nullability of reference types in value of type '(object x, object?)'
    doesn't match target type '(object, object)'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions