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

Comment before the import section leads to the parse error #2190

Closed
vrom911 opened this issue Jun 13, 2023 · 2 comments · Fixed by #2240
Closed

Comment before the import section leads to the parse error #2190

vrom911 opened this issue Jun 13, 2023 · 2 comments · Fixed by #2240
Assignees
Milestone

Comments

@vrom911
Copy link
Contributor

vrom911 commented Jun 13, 2023

When trying to typecheck this module:

module HelloWorld;

------------------------------
--- Standard library imports
------------------------------

open import Stdlib.Prelude;

main : IO;
main := printStringLn "Hello world!";

I get the error:

> juvix typecheck HelloWorld.juvix                                                                                                                                                                                 
/.../HelloWorld.juvix:8:5: error:
/.../HelloWorld.juvix:8:5:
  |
8 | open import Stdlib.Prelude;
  |     ^
expecting "--", "{-", :=, or newline

However, when I remove the comment that is coming after the module and before the import:

module HelloWorld;

open import Stdlib.Prelude open;

main : IO;
main := printStringLn "Hello world!";

It compiles just fine.

This is new behaviour that started with 0.4.0 juvix version. Before it was not the error.

@lukaszcz lukaszcz added this to the 0.4.2 milestone Jun 27, 2023
@janmasrovira
Copy link
Collaborator

the problem is that --- is reserved for introducing judoc comments, try

------------------------------
-- Standard library imports
------------------------------

I'm a bit confused about why this was introduced in 0.4.0, since we had judoc comments much before that

@janmasrovira
Copy link
Collaborator

After testing it I see that parsing more than two consecutive '-' as a comment does not work. I.e. ---- is not parsed as a valid comment.

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