Skip to content

Allow closing '>' of multiline nested type arguments to align with the opener (#15171)#20003

Open
edgarfgp wants to merge 5 commits into
dotnet:mainfrom
edgarfgp:fix-15171-multiline-typeargs
Open

Allow closing '>' of multiline nested type arguments to align with the opener (#15171)#20003
edgarfgp wants to merge 5 commits into
dotnet:mainfrom
edgarfgp:fix-15171-multiline-typeargs

Conversation

@edgarfgp

@edgarfgp edgarfgp commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Problem

A nested, multiline type-argument list fails to parse when the inner closing > is aligned with the column of the opening type name. Adding one extra space before the > avoids it.

Fixes #15171.

Before

type Terminal =
    abstract onKey:
        IEvent<
            Foo<
                Bar * int
            >          // aligned with 'Foo' → error FS0010: Incomplete structured construct ... in type arguments
        > with get, set

After

type Terminal =
    abstract onKey:
        IEvent<
            Foo<
                Bar * int
            >          // now accepted
        > with get, set

Cause

The closing > at the same column as the enclosing sequence block's start, on a later line, was treated as a block separator (OBLOCKSEP), which broke the type-argument parse. A closing > of a type application is a closing bracket like ) or ], so it now belongs in isSeqBlockElementContinuator alongside RPAREN/RBRACK/RBRACE. Scoped to GREATER true (the type-app close), so the > comparison operator is unaffected.

…e opener (dotnet#15171)

A nested multiline type-argument list whose closing '>' was aligned with the
column of the opening type name was rejected with FS0010, because the '>' at
the block-start column was treated as a sequence-block separator (OBLOCKSEP).

A closing '>' of a type-application is a closing bracket like ')' or ']', so
add it to isSeqBlockElementContinuator (scoped to GREATER true, the type-app
close, leaving the '>' comparison operator unaffected).
@github-actions

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ Found changes and release notes in following paths:

Warning

No PR link found in some release notes, please consider adding it.

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md No current pull request URL (#20003) found, please consider adding it

@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Jun 26, 2026

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI review (@expert-reviewer): no significant issues found. Please verify independently.

Verified

  • The new arm | GREATER true -> true in isSeqBlockElementContinuator is correctly scoped: GREATER true is only emitted for a type-application / typar-decl closing > (lex filter), while the comparison operator stays GREATER false (lex.fsl). So the > comparison operator is unaffected, as claimed.
  • Consistent with existing precedent: TokenRExprParen (LexFilter.fs:196) already classifies GREATER true as a right-paren-like closing bracket alongside RPAREN/RBRACK/RBRACE.
  • The continuator is only consulted when the token sits exactly at the seq-block offside column on a later line (LexFilter.fs:1925-1934). A new seq-block element never legitimately begins with a type-app-closing >, so no needed OBLOCKSEP is suppressed.
  • Nested type-argument seq-blocks route through the �lse branch (isSeqBlockElementContinuator), not the isTypeCtxt branch (isTypeSeqBlockElementContinuator), which is why the fix covers the reported �bstract member case.
  • Test coverage is appropriate: a ComponentTests typecheck-success case plus a SyntaxTree parse baseline.

Minor (non-blocking)

  • Consider a sibling test for �al/record-field type annotations using the same multiline aligned-> shape, to lock in that they share the same lex-filter path.

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Jun 30, 2026
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Jun 30, 2026
@T-Gro T-Gro self-requested a review June 30, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-reviewed PR reviewed by AI review council AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Multiline type arguments parse issue

2 participants