-
-
Notifications
You must be signed in to change notification settings - Fork 436
Update splice plugin #4915
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
Update splice plugin #4915
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cdcb4fe
Enable splice plugin on all GHCs
georgefst d606305
Add failing tests for TH declaration splices
georgefst f06a17d
Fix splice plugin on GHC 9.10 by using relative annotations in grafte…
georgefst cfc780a
Fix splice plugin on GHC 9.14
georgefst e1105de
Remove redundant constraint
georgefst 7d30793
Re-add diagnostics for GHC 9.14 splices
georgefst 5d698a1
Merge branch 'master' into splice-plugin-9.14
georgefst 9b7ce10
Fix incorrect merge conflict resolution
georgefst 1477f43
Fix further merge conflict issues
georgefst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
7 changes: 7 additions & 0 deletions
7
plugins/hls-splice-plugin/test/testdata/TDeclData.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclData where | ||
| import Language.Haskell.TH | ||
|
|
||
| data MyData | ||
| = MyConA Int | MyConB String | ||
| deriving (Show, Eq) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclData where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(pure <$> dataD (pure []) (mkName "MyData") [] Nothing | ||
| [ normalC (mkName "MyConA") [bangType (bang noSourceUnpackedness noSourceStrictness) [t|Int|]] | ||
| , normalC (mkName "MyConB") [bangType (bang noSourceUnpackedness noSourceStrictness) [t|String|]] | ||
| ] | ||
| [derivClause Nothing [conT ''Show, conT ''Eq]]) |
5 changes: 5 additions & 0 deletions
5
plugins/hls-splice-plugin/test/testdata/TDeclForeignImport.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclForeignImport where | ||
| import Language.Haskell.TH | ||
|
|
||
| foreign import ccall unsafe "math.h sin" c_sin :: Double -> Double |
5 changes: 5 additions & 0 deletions
5
plugins/hls-splice-plugin/test/testdata/TDeclForeignImport.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclForeignImport where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(pure <$> forImpD cCall unsafe "math.h sin" (mkName "c_sin") [t|Double -> Double|]) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-splice-plugin/test/testdata/TDeclInstance.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclInstance where | ||
| import Language.Haskell.TH | ||
|
|
||
| data Wrapper = MkWrapper Int | ||
| instance Show Wrapper where | ||
| show (MkWrapper n) = ("Wrapper:" ++ show n) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclInstance where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(do dataDec <- dataD (pure []) (mkName "Wrapper") [] Nothing | ||
| [normalC (mkName "MkWrapper") [bangType (bang noSourceUnpackedness noSourceStrictness) [t|Int|]]] | ||
| [] | ||
| instDec <- instanceD (pure []) (appT (conT ''Show) (conT (mkName "Wrapper"))) | ||
| [ funD (mkName "show") [clause [conP (mkName "MkWrapper") [varP (mkName "n")]] | ||
| (normalB [|"Wrapper:" ++ show n|]) []] | ||
| ] | ||
| pure [dataDec, instDec]) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-splice-plugin/test/testdata/TDeclNewtype.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclNewtype where | ||
| import Language.Haskell.TH | ||
|
|
||
| newtype MyNewtype | ||
| = MkMyNewtype Int | ||
| deriving Show |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclNewtype where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(pure <$> newtypeD (pure []) (mkName "MyNewtype") [] Nothing | ||
| (normalC (mkName "MkMyNewtype") [bangType (bang noSourceUnpackedness noSourceStrictness) [t|Int|]]) | ||
| [derivClause Nothing [conT ''Show]]) |
6 changes: 6 additions & 0 deletions
6
plugins/hls-splice-plugin/test/testdata/TDeclPatSyn.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| {-# LANGUAGE PatternSynonyms #-} | ||
| module TDeclPatSyn where | ||
| import Language.Haskell.TH | ||
|
|
||
| pattern MyPattern <- 42 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| {-# LANGUAGE PatternSynonyms #-} | ||
| module TDeclPatSyn where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(pure <$> patSynD (mkName "MyPattern") (prefixPatSyn []) unidir (litP (integerL 42))) |
7 changes: 7 additions & 0 deletions
7
plugins/hls-splice-plugin/test/testdata/TDeclPragma.expected.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclPragma where | ||
| import Language.Haskell.TH | ||
|
|
||
| myId :: Int -> Int | ||
| {-# INLINE myId #-} | ||
| myId x = x |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| {-# LANGUAGE TemplateHaskell #-} | ||
| module TDeclPragma where | ||
| import Language.Haskell.TH | ||
|
|
||
| $(sequence | ||
| [ sigD (mkName "myId") [t|Int -> Int|] | ||
| , pragInlD (mkName "myId") Inline FunLike AllPhases | ||
| , funD (mkName "myId") [clause [varP (mkName "x")] (normalB (varE (mkName "x"))) []] | ||
| ]) |
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.