dotnet / dotnet/fsharp

Value inside parenthesized lambda is generalized when it shouldn't be

Open
#4,144 5 comments 0 reactions 0 assignees View on GitHub
Area-LangService-AutoComplete Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

VS 2017, 15.5.2 + VSIX

Given the following code:

```fsharp
open System.Linq

[""].Join([""], (fun x -> x.
```

**Expected:** `x` is of type `string`, as the `TOuter` type [in the method](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.join?view=netframework-4.7) is a string.
**Actual:** `x` is of type `'a`

If I do not surround the lambda with parentheses, `x` is inferred to be `string`:

![oopsie](https://user-images.githubusercontent.com/6309070/34184181-3cd5e08e-e4d3-11e7-820d-4c90765b9e47.gif)

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.