Skip to content

Breaking change for DU with [<RequireQualifiedAccess>] formatting in 4.7.2Β #9357

@atsapura

Description

@atsapura

In FSharp.Core 4.7.0 the name of Discriminated Union is ignored in text formatting even if [<RequireQualifiedAccess>] is present.

However in 4.7.2 this name is added as a prefix for union case.

Repro steps

  1. Use FSharp.Core 4.7.2
  2. Declare a union type with RequireQualifiedAccess attribute:
[<RequireQualifiedAccess>]
type ResponseGroup =
        | ItemLarge
        | None
  1. Format it using %A as in sprintf "%A" ResourceGroup.None

Expected behavior

Snippet above yields "None" as it would in 4.7.0

Actual behavior

It yields "ResponseGroup.None"

Known workarounds

  • Override ToString() and use %O instead of %A
  • Remove RequireQualifiedAccess if that's applicable.
  • Rollback to FSharp.Core 4.7.0

Related information

  • Windows 10 Pro
  • Net core 3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions