dotnet / dotnet/fsharp

FSharpMemberOrFunctionOrValue doesn't include attributes for params in CurriedParameterGroups

Open
#13,786 0 comments 0 reactions 0 assignees View on GitHub
Area-FCS Feature Improvement Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

This seems to be a known issue because there are several comments in `FSharpMemberOrFunctionOrValue` like this one: https://github.com/dotnet/fsharp/blob/236db9817ee215ce3c086928ace8c891d8c3564d/src/Compiler/Symbols/Symbols.fs#L2047-L2062

Not sure if this something that is not possible/easy to implement or it's been a TODO that has remained in the code base. Interestingly when members are internally represented as function values (`.Data = V ...`) the attributes for params can be accessed: https://github.com/dotnet/fsharp/blob/236db9817ee215ce3c086928ace8c891d8c3564d/src/Compiler/Symbols/Symbols.fs#L2064-L2080

This seems to be the reason this issue hasn't surfaced in Fable until now. In Fable we sometimes use param attributes to give info about how a parameter should be compiled in the call-site. Until Fable 3 this information was directly taken from the member reference in `FSharpExprPatterns.Call`. It seems in this case the member is always represented as function value and the param attributes are kept. However, in Fable 4 we are using a different model where entity and member info are kept separated from the AST to make serialization easier. Because of this, the parameter info is accessed now through `FSharpEntity.MembersFunctionsAndValues` and apparently this causes members to be represented as methods (`.Data = M ...`) and the param attributes to be lost when calling `CurriedParameterGroups`.

@dsyme Would it be possible to fix this in FCS or is it a limitation we need to overcome somehow?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.