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

feat: Add colors to parser errors #7712

Merged
merged 7 commits into from
May 14, 2024
Merged

Conversation

herluf-ba
Copy link
Contributor

Closes #7700

This PR adds colors to parser errors. It also makes sure all errors are similarly worded, has context and the right source location and is reasonably concise.
Here's a preview of how the colors look for this faulty program:

def one() Int16 = 1i16

def main(): Bool =
    let l = List#{1, 2, 3,};
    List.length(l) == one()

Screenshot 2024-05-09 at 12 04 40

Although completely unrelated please take a moment to enjoy the type error despite having two syntax errors.

@magnus-madsen
Copy link
Member

@herluf-ba Conflicted again, sorry.

@magnus-madsen
Copy link
Member

I like the changes 👍

@herluf-ba
Copy link
Contributor Author

@magnus-madsen This is ready for another round of review 👍

Copy link
Member

@magnus-madsen magnus-madsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a lot of comments. My review boils down to:

  • We should think of the error classes themselves as data types in their own right. This means they must be "well designed" and limit how "stringly" typed they are. The reason is that this make the errors reusable, e.g. for VSCode when we want to provide quick fixes, auto-complete etc.

@herluf-ba
Copy link
Contributor Author

@magnus-madsen I addressed all of your comments 👍

@magnus-madsen magnus-madsen merged commit f49637e into flix:master May 14, 2024
13 checks passed
@magnus-madsen
Copy link
Member

Merged! Thanks

LionelMeli pushed a commit to LionelMeli/flix that referenced this pull request May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parser: Add colors to ParseError
2 participants