Skip to content

Printed quotations show a struct tuple as NewTuple #20800

Closed

Description

@xperiandri

Expr.ToString () and %A print the construction of a struct tuple exactly like the construction of a reference tuple, so a printed quotation does not show which tuple kind it builds.

Repro steps

printfn "%A" <@ struct (1, "a") @>
printfn "%A" <@ (1, "a") @>

Expected behavior

The struct tuple prints with the name of its active pattern and constructor (#8193): NewStructTuple (Value (1), Value ("a")).

Actual behavior

Both lines print NewTuple (Value (1), Value ("a")). Only Expr.Type tells them apart. Patterns.NewStructTuple matches the first quotation only, so the printer is the one place that hides the difference.

This matters for code that rewrites quotations: Expr.NewTuple always builds System.Tuple, so a rewrite that rebuilds a struct tuple with it changes the type of the tree, and a test that compares printed quotations cannot catch that.

Known workarounds

Compare Expr.Type (IsValueType) instead of the printed text.

Related information

  • FSharp.Core 10.1.0.0, .NET SDK 10.0.402 (dotnet fsi), Windows 11

Activity

  1. added theissue type on Oct 17, 2026
  2. added this to the Backlog milestone on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions