Skip to content

FSharpMemberOrFunctionOrValue.Overloads does not return overloads #356

Closed
@7sharp9

Description

@7sharp9

For example the following code:

type JustOverloads() =
  member x.Overload(i:int) =
    i + 42
  member x.Overload(s:string) =
    int s + 42

The symbol Overload is a MemberFunctionOrValue but is assigned a ValRef type so the Overloads code doesnt ever return an item:

    member x.Overloads matchParameterNumber =
        checkIsResolved()
        match d with
        | M m ->
            match item with
            | Item.MethodGroup (_name, methodInfos) ->
                let methods =
                    if matchParameterNumber then
                        methodInfos
                        |> List.filter (fun methodInfo -> not (methodInfo.NumArgs = m.NumArgs) )
                    else methodInfos
                methods
                |> List.map (fun mi -> FSharpMemberOrFunctionOrValue(cenv, M mi, item))
                |> makeReadOnlyCollection
                |> Some
            | _ -> None
        | _ -> None

Im not sure why the members are created as ValRef rather than MethInfo is it the case that only C# types with overloads are assigned that way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions