Skip to content

Signature file generation does not handle literal values #13810

Closed

Description

@nojaf

When generating a signature file from an attribute that uses a literal, the generated code will have the constant value instead of the literal.

Repro steps

module Maybe

open System.ComponentModel

[<Literal>]
let A = "A"

module SubModule =
    type Foo() =
        [<Category(A)>]
        member this.Meh () = ()

leads to

module Maybe

[<Literal>]
val A: string = "A"

module SubModule =
    
    type Foo =
        
        new: unit -> Foo
        
        [<System.ComponentModel.Category ("A")>]
        member Meh: unit -> unit

Expected behaviour

The generated signature should be considered equivalent to the backing source file.

Actual behaviour

The generated code is using a hardcoded string "A" instead of the defined literal A.

Known workarounds

Edit signature file by hand.

Activity

  1. added this to the Backlog milestone on Sep 9, 2022
  2. added
    Area-Compiler-SigFileGen
    on Sep 9, 2022
  3. added 3 commits that reference this issue on Apr 14, 2026
    b74e0e3
    a3c068e
    7fc0698
  4. added a commit that references this issue on Apr 16, 2026
    0abb33d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-SigFileGenBugImpact-Medium

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions