fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

investigate if fs0064 error message can be tailored

Open smoothdeveloper opened this issue 1 year ago • 1 comments

reported by jurasiks on the discord

type Paginator(source: ResizeArray<'T>, currentPage: int, pageSize: int) =
  member x.A() = ()

FS0064 This construct causes code to be less generic than indicated by the type annotations. The type variable 'T has been constrained to be type 'obj'.

I know this message can show up in various circumstances, in this case Paginator<'T> needs to be the type name.

For this special case, we could suffix the error message with:

Consider adding the generic type parameter 'T to the type name: Paginator<'T>

or a variation that doesn't quote the symbols, but still guides the user, if quoting symbols is not trivial.

related: #1103

smoothdeveloper avatar Mar 13 '24 12:03 smoothdeveloper

It'll probably a good use case for analyser (I.e. it doesn't have to run in process in compiler).

vzarytovskii avatar Mar 13 '24 13:03 vzarytovskii