Skip to content

Valid type alias with anonymous record report error #17407

Open
@jindraivanek

Description

@jindraivanek

This type alias:

type T =
    {| Id: Guid
    |} []

leads to error: Unexpected symbol '[' in member definition

Replacing [] with another generic type (seq, list, option) leads to similar error: Unexpected identifier in member definition

Expected behavior

Code should be accepted by compiler.

Actual behavior

Compiler error when {| and |} are vertically aligned and there is generic type after |}

Known workarounds

  • Indent closing bracket one space further.
  • Use T<A> generic type syntax.

Related information

dotnet --version
8.0.204

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-Syntaxlexfilter, indentation and parsingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.Triage-Investigate

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions