Skip to content

Added font lock tests for pattern synonyms (for #1313) #1337

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

Merged
merged 2 commits into from
May 23, 2016

Conversation

taktoa
Copy link
Contributor

@taktoa taktoa commented May 22, 2016

I wrote tests for the font lock issues with the pattern keyword, as discussed in #1313.

Please check if the way I used check-properties is correct, since:

  • It wasn't entirely clear but it seemed like the triplets in the second argument of check-properties each describe the fact that a token should be fontified a particular way in all the test strings given in the first argument (the alternative interpretation is that the triplets describe a series of fontifications for each token in order, and since none of the existing tests duplicate the first element of a triple, it's ambiguous which it is).
  • I gave t as the second element of each triple, which I am not sure about either. This element is the "syntax" of the token, but I don't know enough about Emacs fontification to know what that means.

The haskell-no-pattern-1 and haskell-no-pattern-2 tests currently pass, so I commented out the :expected-result :failed so as to prevent an error.

cc: @gracjan

EDIT: fun fact, this is pull request number 1337 on haskell-mode :D

"pattern A :: (C a) => () => a -> B"
"pattern A :: (C a) => (C a) => a -> B"
"pattern A :: (C a) => (C a) => a -> B")
'(("pattern" t haskell-keyword-face)
Copy link
Contributor

Choose a reason for hiding this comment

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

This checks only this first pattern. You need to write as many patter rules as there are pattern keywords in the example code. It is okay to leave out other tokens, check-properties skips over fragments that aren't listed.

@gracjan gracjan merged commit dec48ff into haskell:master May 23, 2016
@gracjan
Copy link
Contributor

gracjan commented May 23, 2016

Thanks.

@gracjan
Copy link
Contributor

gracjan commented Aug 27, 2016

Looks like I was wrong and when PatternSynonyms are enabled then pattern is a keyword everywhere it appears. For example this is a syntax error:

foo :: (a -> pattern) -> a -> pattern

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.

2 participants