Skip to content

Signature file generation does not handle literal values #13810

Open
@nojaf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-SigFileGengeneration of signature files - both compiler and IDEBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions