Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Confusing error location on type syn <- foo [bar] #302

Open
s5bug opened this issue Sep 1, 2021 · 1 comment
Open

Confusing error location on type syn <- foo [bar] #302

s5bug opened this issue Sep 1, 2021 · 1 comment
Labels

Comments

@s5bug
Copy link

s5bug commented Sep 1, 2021

In the code

type foo <- list [string]

I accidentally use [string] instead of list string. This leads to a confusing error:

types.ml[1:1 ..1:8]: error (E2001)
  │
1 │ type foo <- list [string]
  │ ^^^^^^^^
  Couldn't match actual type type
    with the type expected by the context, list type

The error location is wrong, pointing to type foo instead of [string].

The same error does not occur without a type constructor, in fact type foo <- [string, int] is accepted as valid by amc. Should I open an issue for that too?

@SquidDev SquidDev added the bug label Sep 1, 2021
@SquidDev
Copy link
Member

SquidDev commented Sep 1, 2021

Oh, this'll be interesting. I have a feeling we don't preserve position information by the time we get to the TC.

The same error does not occur without a type constructor, in fact type foo <- [string, int] is accepted as valid by amc. Should I open an issue for that too?

That bit is intentional - it's a type-level list.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants