Skip to content

FSharpMemberOrFunctionOrValue.Overloads does not return overloads #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7sharp9 opened this issue Jun 24, 2015 · 1 comment
Closed

FSharpMemberOrFunctionOrValue.Overloads does not return overloads #356

7sharp9 opened this issue Jun 24, 2015 · 1 comment
Labels

Comments

@7sharp9
Copy link
Member

7sharp9 commented Jun 24, 2015

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?

ctaggart pushed a commit to ctaggart/FSharp.Compiler.Service that referenced this issue Jun 30, 2015
Fix for installation paths with a space in
@alfonsogarciacaro
Copy link
Contributor

I checked this with last build and now Overloads() returns an item, but it's always the same method without references to other overloads.

In above example, calling [JustOverloads Entity].MembersFunctionsAndValues.[1].Overloads(false) will give Some(seq [Overload(i:int)]) but you don't get information about Overload(s:string).

Moreover, if you call Overloads(false) on a FSharpMemberOrFunctionOrValue taken from a typed expression you still don't get any item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants