Fix: treat top-level QuasiQuote splices as using QuasiQuotes (fixes #1650)#1684
Open
mgajda wants to merge 1 commit intondmitchell:masterfrom
Open
Fix: treat top-level QuasiQuote splices as using QuasiQuotes (fixes #1650)#1684mgajda wants to merge 1 commit intondmitchell:masterfrom
mgajda wants to merge 1 commit intondmitchell:masterfrom
Conversation
…dmitchell#1650) Top-level quasi-quote declarations like {-# LANGUAGE QuasiQuotes #-} [qq| ... |] produce an HsSpliceD node, not an HsExpr. The existing QuasiQuotes usage predicate only checked HsExpr-level (isQuasiQuoteExpr) and type-level (isTyQuasiQuote), so the pragma was flagged as "Unused LANGUAGE pragma" even though removing it breaks the parse. Extend the check with isQuasiQuoteSplice (already exported from ghc-lib-parser-ex and used in the TemplateHaskell predicate for the complementary purpose). Test: {-# LANGUAGE QuasiQuotes #-} [qq| ... |] is now accepted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1650.
Top-level quasi-quote declarations like
{-# LANGUAGE QuasiQuotes #-} [qq| ... |]produce an
HsSpliceDnode, not anHsExpr. Theused QuasiQuotespredicate insrc/Hint/Extensions.hsonly checkedHsExpr-level (isQuasiQuoteExpr) and type-level (isTyQuasiQuote), so the pragma was flagged as "Unused LANGUAGE pragma" even though removing it breaks the parse.Extend the check with
isQuasiQuoteSplice, already exported fromghc-lib-parser-exand already used in theTemplateHaskellpredicate for the complementary purpose.Test added to
<TEST>block insrc/Hint/Extensions.hs. Self-test: 965 tests, all pass.