-
Notifications
You must be signed in to change notification settings - Fork 854
Open
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
Consider this code (type annotations added for clarity):
async {
let asyncUnitArr : Async<unit []> = async.Return [| () |]
do! asyncUnitArr
}It fails to compile with this message on the second asyncUnitArr:
This expression was expected to have type 'unit[]' but here has type 'unit'
I find this confusing for two reasons.
Firstly, the expression that is underlined, asyncUnitArr, has the type Async<unit []>, so the message seems to be missing the Async wrapper.
Secondly, the wording/types seem to be switched around. The expression has the type Async<unit []> and (given the context) is expected to have the type Async<unit>.
For comparison, here is a similar error message that seems to be correct:
let f (x: int) = ()
f ""Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.

