Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error messages for named record arguments #2796

Closed
lukaszcz opened this issue Jun 3, 2024 · 0 comments · Fixed by #3012
Closed

Confusing error messages for named record arguments #2796

lukaszcz opened this issue Jun 3, 2024 · 0 comments · Fixed by #3012

Comments

@lukaszcz
Copy link
Collaborator

lukaszcz commented Jun 3, 2024

Typechecking:

module recordError;

import Stdlib.Prelude open;

type T :=
  mkT {
    x : Nat;
    y : Nat
  };

p : T :=
  mkT {
    x := 0;
    y := 0;
  };

gives the error:

/home/heliax/Documents/progs/juvix/recordError.juvix:15:3: error:
/home/heliax/Documents/progs/juvix/recordError.juvix:15:3:
   |
15 |   };
   |   ^
unexpected '}'
expecting <identifier>

This is about the definition of p. The error should point at the opening { and say that @ is missing.

Carlo was quite confused by this. It's hard to figure out what's wrong if you don't remember you need the @, and even if you do it's easy to miss and be confused, because the error points at the wrong place.

The error changes (but is still confusing) if we remove the final ; inside the record creation.

Typechecking:

module recordError;

import Stdlib.Prelude open;

type T :=
  mkT {
    x : Nat;
    y : Nat
  };

p : T :=
  mkT {
    x := 0;
    y := 0
  };

results in:

/home/heliax/Documents/progs/juvix/recordError.juvix:13:5-11: error:
Unexpected named arguments:
• x := 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants