dotnet / dotnet/fsharp

Improve error reporting: Trying to pass arguments to a simple value gives confusing error.

Open
#5,476 5 comments 1 reaction 1 assignee Claimed by @edgarfgp View on GitHub
Area-Diagnostics Feature Improvement
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

## What
This code leads to the following error:

```fsharp
let x = 5
x 10
^
```
```
error FS0003: This value is not a function and cannot be applied.
```

## Why
Beginners to the language try to read this error and 9/10 times don't understand what it means.

## How
Consider replacing the error message with something like:

```
"x" is a simple value of type "int", and not a function. It does not take in any arguments, but you are trying to pass the value "10" as an argument to it.
```

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.