dotnet / dotnet/fsharp

Overload resolution does not prefer method that would need less conversions

Open
#14,318 2 comments 3 reactions 0 assignees View on GitHub
Area-Compiler-Checking Area-Compiler-Checking-Overloads Feature Improvement Needs-RFC
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

Found in https://github.com/dotnet/fsharp/issues/14302

```fs
type M() =
static member A(m: int64 array, n: int64) = 1
static member A(m: System.ReadOnlySpan, n: int64) = 2

let test() = M.A([|10L|], 1)
```

I would say we should prefer the first overload here instead of failing with an overload error.

https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AbEAzAzgHwBcBPABxgAIBZACgEoKBeAWACgKOLdCBDQgSzAUAtjGHAYUCgEEawkBX4A7Qqgo8oUHsTQUlC5apQNGFAIxtOXXgKGjxkmXIUBlYtzEA6AEoweAEwB5JQxiF1IeJQAeQ1QAPl19RRVUEwoAJjY2DBhCCkIYbnomak9ZAG18MwAGABl8AF1dMzogA=

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.