Skip to content

Confusing error message when accessing a field that is missing from a type #2354

@interacsion

Description

@interacsion
nickel> (fun x => x.a): {} -> _

error: type error: missing row `a`
  ┌─ <repl-input-130>:1:11
  │
1 │ (fun x => x.a): {} -> _
  │           ^ this expression
  │
  = Expected an expression of type `{ a : _a; _rrows_b }`, which contains the field `a`
  = Found an expression of type `{  }`, which does not contain the field `a`

This is rather difficult to understand. a much better message would be along these lines:

error: type error: missing field `a`
  ┌─ <repl-input-130>:1:11
  │
1 │ (fun x => x.a): {} -> _
  │             ^ this field
  │
  = Attempted to access field `a` on an expression of type `{  }`

@yannham

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions