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

Annotations are ignored when comment is not closed with @-} #1049

Closed
nikivazou opened this issue Jun 15, 2017 · 4 comments · Fixed by #1082
Closed

Annotations are ignored when comment is not closed with @-} #1049

nikivazou opened this issue Jun 15, 2017 · 4 comments · Fixed by #1082

Comments

@nikivazou
Copy link
Member

The following is SAFE

{-@ incr :: x:Int -> {v:Int | x < v } -}
incr :: Int -> Int 
incr x = x - 1

Because the annotation is not closing with @.
Maybe we need to create a warning in this case?

@ranjitjhala
Copy link
Member

Whoa! Are the annotations even parsed? Actually I think not, because the parser literally sucks out text between {-@ ... @-} before doing any parsing, so if you don't close, then ... that text is just empty... :-/

@nikivazou
Copy link
Member Author

Exactly, the annotations are not parsed.

I just got an email from a user wondering what is wrong with an annotation like this and took me a log time to spot the typo. So, maybe a warning could be helpful.

@ranjitjhala
Copy link
Member

Hmm. Maybe tweak the "between" parser to warn if there is an "open" {-@ ? (should be easy...)

@gridaphobe
Copy link
Contributor

GHC throws an error if you have an improperly closed pragma, e.g.

{-# LANGUAGE Blah -}
    /Users/gridaphobe/Source/liquid/haskell/src/Language/Haskell/Liquid/GHC/Interface.hs:1:14: error:
        Cannot parse LANGUAGE pragma
        Expecting comma-separated list of language options,
        each starting with a capital letter
          E.g. {-# LANGUAGE TemplateHaskell, GADTs #-}

I think this is a good idea (but we can do better with the error message)!

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