Skip to content
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

VS tooltip display too verbose when calling overloaded method with wrong parameter types #6578

Closed
smoothdeveloper opened this issue Apr 19, 2019 · 3 comments

Comments

@smoothdeveloper
Copy link
Contributor

smoothdeveloper commented Apr 19, 2019

This is an error message improvement suggestion after seeing a picture posted in fsharp.org's slack (user Alanay).

Overload can be little tricky at times, when the overload count is too too high, it would be good to have the VS tooltip show a prettier summary.

Repro steps

Here is a simple case with System.Convert.ToString :

let a = System.Convert.ToString('w',4);;

Actual behavior

image

Expected behavior

Looking for proposals, here is a first one which would read better:

No overloads match for method 'ToString'.

Argument types given:
  - char
  - int
  
Available overloads:
  - Convert.ToString(value: obj, provider: IFormatProvider)
  - Convert.ToString(value: bool, provider: IFormatProvider)
  - Convert.ToString(value: bool, provider: IFormatProvider)
  - Convert.ToString(value: char, provider: IFormatProvider)
  - Convert.ToString(value: sbyte, provider: IFormatProvider)
  - Convert.ToString(value: byte, provider: IFormatProvider)
  ... exhaustive list we partially see

Workarounds

  • reduce overload count
  • taller screens

Related information

@smoothdeveloper
Copy link
Contributor Author

smoothdeveloper commented Apr 25, 2019

I'll look at this message (sample from #2503 (comment)):

open System
open System.Threading.Tasks
let makeTask () = new Task<_>(fun () -> 1)
let task = makeTask()
let rt1 = Task.Run(fun () -> task)

Actual:

A unique overload for method 'Run' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: Task.Run<'TResult>(function: Func<'TResult>) : Task<'TResult>, Task.Run<'TResult>(function: Func<Task<'TResult>>) : Task<'TResult>

It doesn't look great in VS:

image

Looking for:

A unique overload for method 'Run' could not be determined based on type information prior to this program point. 

A type annotation may be needed. 

Candidates: 
- Task.Run<'TResult>(function: Func<'TResult>) : Task<'TResult>
- Task.Run<'TResult>(function: Func<Task<'TResult>>) : Task<'TResult>

Please let me know if that makes sense.

I've made some progress in my branch (#6596) for the initial case:

image

There is work ahead for additional coverage of those messages as it is only lightly covered in fsharpqa tests. (edit: coverage seems appropriate)

More input from users with verbose overload resolution messages in advanced and simple cases would be greatly appreciated.

@cartermp cartermp modified the milestones: 16.2, Backlog Apr 30, 2019
@smoothdeveloper
Copy link
Contributor Author

closing this one which got merged in #6596.

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

No branches or pull requests

2 participants