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

Fix issue 2128 #2144

Merged
merged 3 commits into from
May 22, 2016
Merged

Fix issue 2128 #2144

merged 3 commits into from
May 22, 2016

Conversation

bmjames
Copy link
Contributor

@bmjames bmjames commented May 19, 2016

This is intended to fix #2128.

That issue relates to the error messaging from the parser; the two failing cases I have added need to be compiled manually to demonstrate that the error message is accurate:

[nix-shell:~/purescript]$ psc examples/failing/2128-instance.purs
Error found:
at /home/ben/purescript/examples/failing/2128-instance.purs line 8, column 9 - line 8, column 9

  Unable to parse module:
  unexpected !!!
  expecting expression

and

[nix-shell:~/purescript]$ psc examples/failing/2128-class.purs
Error found:
at /home/ben/purescript/examples/failing/2128-class.purs line 5, column 15 - line 5, column 15

  Unable to parse module:
  unexpected !!!
  expecting qualifier, proper name, (, {, _, "forall", "\8704" or identifier

If you think the testing should be improved to guard automatically against a regression, please could you give me some guidance on how to approach that?

members <- P.option [] . P.try $ do
indented *> reserved "where"
members <- P.option [] $ do
P.try $ indented *> reserved "where"
Copy link
Contributor

@paf31 paf31 May 22, 2016

Choose a reason for hiding this comment

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

Do we need this try? reserved "where" should either consume everything or nothing, there should be no reason to backtrack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, try is superfluous here.

@paf31
Copy link
Contributor

paf31 commented May 22, 2016

Thanks for this. Could you please update CONTRIBUTORS.md too?

@paf31
Copy link
Contributor

paf31 commented May 22, 2016

Thanks!

@paf31 paf31 added this to the 0.9.0 milestone May 22, 2016
@kritzcreek
Copy link
Member

Cool!

@paf31 paf31 merged commit 9572706 into purescript:master May 22, 2016
@paf31
Copy link
Contributor

paf31 commented May 24, 2016

I just realized this is on master. We'll have to remember to merge and cut 0.9.1 from master then.

archaeron pushed a commit to archaeron/purescript that referenced this pull request Apr 6, 2017
* No backtracking out of class/instance body once 'where' is parsed

* Remove unnecessary try

* Update CONTRIBUTORS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor error messaging for syntax errors inside type class and instance declarations
3 participants