Skip to content

Misleading error on non-unit value in do-block #5686

Open
@ChrisPenner

Description

@ChrisPenner

In UCM 0.5.39

For the following:

badError = force do
  1
  ()

I get the rather misleading error

  The 1st argument to `force`

            has type:  Nat
      but I expected:  Unit

     46 | badError = force do
     47 |   1
     48 |   ()

Which is misleading because the first argument to force most certainly does not have type Nat :(


Whereas I'd expect an error closer to what I get without the force, which is:

badError = do
  1
  ()
  I found a value  of type:  Nat
  where I expected to find:  Unit

     47 |   1
     48 |   ()

    from right here:

     47 |   1

  Hint: Actions within a block must have type Unit.
        Use _ = <expr> to ignore a result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    error-messageRequest for improved error message

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions