Skip to content

Inferred type in async expression lambda does not unwrap Task #30232

@Neme12

Description

@Neme12
using System;
using System.Threading.Tasks;

class C
{
    void M()
    {
        Func<Task<int>> f1 = async () => { return foo; }; // correctly generates int

        Func<Task<int>> f2 = async () => foo; // generates Task<int>
    }
}

If I choose to generate a field in the first lambda, its type will be int. If I do the same inside the second one, the type of the field will be Task<int>, which is wrong.

(very similar to #27647)

Metadata

Metadata

Assignees

Labels

Area-IDEBugResolution-FixedThe bug has been fixed and/or the requested behavior has been implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions