dotnet / dotnet/fsharp

Unhelpful error when using wrongly indented yield! in list comprehension

Open
#4,400 0 comments 0 reactions 0 assignees View on GitHub
Area-Diagnostics Feature Improvement
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Consider the following code:

module X

let view (props:'a list) (elements:'b list) : 'c list = []

let scrollView (props:'a list) (elements:'b list) : 'c list = []

let wizard = []

let view model =
view [
]
[ yield scrollView []
[
]

yield! wizard
]

It shows two error messages:

![image](https://user-images.githubusercontent.com/57396/36729506-b488481a-1bc4-11e8-8792-2c9eec6c3364.png)

![image](https://user-images.githubusercontent.com/57396/36729524-c713b5be-1bc4-11e8-87e1-92475ced3f5a.png)

Both are not helpful here and the first one is actually wrong since we have balanced brackets.
The real issue is that the line with `yield!` is indented one char to far.

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.