fable-compiler / Fable

F# to JavaScript, TypeScript, Python, Rust and Dart Compiler
http://fable.io/
MIT License
2.93k stars 301 forks source link

Setter property with `[<Erase>]` should be erased #3948

Open MangelMaxime opened 2 weeks ago

MangelMaxime commented 2 weeks ago

Description

While working on #3929, it seems like some cases have not been covered.

This code

[<Erase>]
type internal LanguageInjectionAttribute() =
    inherit Attribute()

    [<Erase>]
    member val Prefix = "" with get, set

does not generate the getter but does generate the setter function:

export function LanguageInjectionAttribute__set_Prefix_Z721C83C5(__, v) {
    __["Prefix@"] = v;
}

Repro code

Please provide the F# code to reproduce the problem or a link to the REPL. Ideally, it should be possible to easily turn this code into a unit test.

Expected and actual results

Please provide the expected and actual results.

Related information

Karfroth commented 6 days ago

I was checking this problem a bit and probably this isn't a Fable problem but FSharp compiler issue.

When I ran the attached code in the example, FSharp compilation result did not add attribute to set_prefix while it does for get_prefix

Tested with dotnet 8.0.403 on the latest main branch.

image image