Skip to content

Improve error reporting: Missing "else" branch for if expression with elif #6873

@isaacabraham

Description

@isaacabraham

Related to #1104. Indeed in that issue there was actually a comment:

This should also apply to if / elif / elif with a missing "else".

What

Exactly the same old error message shows as soon as you add an elif branch e.g.

let x = 10
let y =
   if x > 10 then "test"
   elif x > 2 then "blah"

gives the error:

error FS0001: This expression was expected to have type
    'unit'    
but here has type
    'string'   

Why

Same as #1104.

How

Same as #1104.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

New

Relationships

None yet

Development

No branches or pull requests

Issue actions