Skip to content

Type to generate not inferred in expression bodied getter #26993

@Neme12

Description

@Neme12
class C
{
    int P
    {
        get => newField;
    }
}

Generate field on newField creates it with type object (which of course results in an error):

class C
{
    private object newField;

    int P
    {
        get => newField;
    }
}

The type should be int as is correctly generated when using an expression bodied property or a block with a return statement instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions