Skip to content

CompiledName on a member whose declaring type is in a namespace #977

@Tarmil

Description

@Tarmil

Failing example:

namespace Test

type T() =
    [<CompiledName "A">]
    member this.a() = ()
    //          ^ Fails here with:
    //            The 'CompiledName' attribute cannot be used with this language element

Same thing with a static member instead.

In contrast, the same code works if inside a module rather than a namespace:

module Test

type T() =
    [<CompiledName "A">]
    member this.a() = ()
    // Succeeds and generates the expected .NET method:
    // [CompilationSourceName("a")] public void A() { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions