Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Return associated getter/setter methods of a property #191

Closed
@dungpa

Description

@dungpa

At the moment, property handling is a bit inconsistent. Sometimes, FCS returns Property symbols; in other occasions, it returns PropertyGetterMethod and PropertySetterMethod symbols. It would be great to be able to retrieve getters/setters from the properties e.g. adding to FSharpMemberFunctionOrValue

    /// Indicates if this is a property, there exists an associated getter method
    member HasGetterMethod : bool

    /// Get an associated getter method of the property
    member GetterMethod : FSharpMemberFunctionOrValue

    /// Indicates if this is a property, there exists an associated setter method
    member HasSetterMethod : bool

    /// Get an associated setter method of the property
    member SetterMethod : FSharpMemberFunctionOrValue

Information is already available at https://github.com/fsharp/FSharp.Compiler.Service/blob/ea952394dbf77c947a832b9a2e1bef23ab026187/src/fsharp/infos.fs#L1839.

This gives finer-grained control on property symbols since getters and setters can be defined in different places (in case of extension properties).
With this, we're able to retrieve correct declaration location of an extension member in order to fix #178. It might also help #190 as well.

If you think this is Ok, I can send a PR with changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions