-
-
Notifications
You must be signed in to change notification settings - Fork 921
Open
Description
Problem
Currently with following code:
pub type User {
name: String,
surname: String
}Gleam gives this error:
error: Syntax error
┌─ C:\Users\user\projects\deps_test\src\deps_test.gleam:2:3
│
2 │ name: String
│ ^^^^ I was not expecting this
Each custom type variant must have a constructor:
pub type User {
User(
name: String,
)
}As you see, it says only about one field, which is wrong, I think.
Desired behaviour
It should say about all fields in the error.
Motivation
Firstly, this will improve DX, since user will see full error.
Secondly, this will allow implementation of #3479, which is blocked by this.
Possible solution
I don't know, if this is possible inside parser, since it's fault tolerance skips the entire expression, I think. In case it's possible, we need to say about each field in error.
Things to consider
- Is it possible in parser?
- How to display errors about each field (just one
I was not expecting thisor for each one?)?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels