Skip to content

[JS] [<AttachMembers>] and static inline: invalid JS #4580

@goswinr

Description

@goswinr

When [<AttachMembers>] is used, a static meber inline gets erased as expected from the class.
But it is not inlined at call site.
So invalid JS is emited.

for example:

open Fable.Core

[<AttachMembers>]
type Foo() =

    static member inline one = Foo()

let baz = Foo.one // emits const baz = Foo.one; but should emit Foo_$ctor()

see REPL (v5.0.0)

Yes, this example is contrived. A simple F# module would make more sense here. And [<AttachMembers>] is also unsafe with overloads. But it might still be worth fixing that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions