dotnet / dotnet/fsharp

investigate if fs0064 error message can be tailored

Open
#16,871 1 comment 0 reactions 0 assignees View on GitHub
Analyzers Area-Diagnostics Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

reported by jurasiks on the discord

```fsharp
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

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.