-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use the ghc api to get imports #32
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bb7e557
Use a set for importedModules
googleson78 6ace952
Use ghc to scan imports
googleson78 37ab8fb
Drop parsec stackage dep
googleson78 1923cd4
Crash instead of returning `Maybe`
googleson78 0074047
Remove discussed TODO
googleson78 52eb37c
Reverse if not condition
googleson78 6ec74f7
Use field pun for usesTH
googleson78 4a9a81b
Go through a BS instead of String
googleson78 813a801
Use runGhc instead of faking DynFlags
googleson78 5c45866
Update comment on ghc-boot
googleson78 afde376
Rethrow errors
facundominguez fd0fb8d
Don't convert to string when preprocessing a source file
facundominguez bcca68d
Remove moduleNameToText from GHC.Utils
facundominguez b6fd38f
Remove GHC.Utils
facundominguez 9600894
Edit comment on handling parsing failures
facundominguez 40a52cb
Bring back faking DynFlags
googleson78 55caa5d
Handle himportscan stdout and stderr separately
googleson78 a62dd95
Enable and test PatternSynonymss and ExplicitNamespaces
googleson78 eaefe78
Enable and test MagicHash
googleson78 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 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 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 |
---|---|---|
|
@@ -51,7 +51,6 @@ stack_snapshot( | |
packages = [ | ||
"aeson", | ||
"hspec", | ||
"parsec", | ||
"string-qq", | ||
"tasty", | ||
"tasty-discover", | ||
|
This file contains 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 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 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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE PatternSynonyms #-} | ||
{-# LANGUAGE ExplicitNamespaces #-} | ||
{-# LANGUAGE MagicHash #-} | ||
module Main where | ||
|
||
#define a_multiline macro \ | ||
a second line of the macro | ||
import NonModulesLib (nonModulesLib) | ||
import PackageA.Other.C() | ||
import PackageA.Other.C(type DataC, DataC(DataC), pattern PatTrue) | ||
import GHC.Exts (Int(..), Int#) | ||
|
||
main :: IO () | ||
main = putStrLn $ "Hello, Haskell! " ++ show nonModulesLib | ||
main = do | ||
let | ||
dataC :: DataC | ||
dataC = DataC PatTrue | ||
int# :: Int# | ||
int# = case 1 of I# i -> i | ||
putStrLn $ "Hello, Haskell! " ++ show nonModulesLib ++ show dataC ++ show (I# int#) |
This file contains 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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
{-# LANGUAGE PatternSynonyms #-} | ||
module PackageA.Other.C where | ||
|
||
import PackageA.Exposed.A() | ||
|
||
data DataC = DataC Bool | ||
deriving Show | ||
|
||
pattern PatTrue :: Bool | ||
pattern PatTrue = True |
This file contains 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 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 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 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 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,50 @@ | ||
-- Copyright (c) 2020, Shayne Fletcher. All rights reserved. | ||
-- SPDX-License-Identifier: BSD-3-Clause. | ||
|
||
{-# OPTIONS_GHC -Wno-missing-fields #-} | ||
{-# OPTIONS_GHC -Wno-name-shadowing #-} | ||
|
||
-- This file is a single code path copied over from https://hackage.haskell.org/package/ghc-lib-parser-ex-8.10.0.24/docs/src/Language.Haskell.GhclibParserEx.GHC.Settings.Config.html | ||
-- TODO[GL]: We can get rid of this file once we only support >=9.2, as ParserOpts are much smaller there. | ||
module HImportScan.GHC.Settings( | ||
fakeSettings | ||
, fakeLlvmConfig | ||
) | ||
where | ||
googleson78 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import Config | ||
import DynFlags | ||
import Fingerprint | ||
import GHC.Platform | ||
import ToolSettings | ||
|
||
fakeSettings :: Settings | ||
fakeSettings = Settings | ||
{ sGhcNameVersion=ghcNameVersion | ||
, sFileSettings=fileSettings | ||
, sTargetPlatform=platform | ||
, sPlatformMisc=platformMisc | ||
, sPlatformConstants=platformConstants | ||
, sToolSettings=toolSettings | ||
} | ||
where | ||
toolSettings = ToolSettings { | ||
toolSettings_opt_P_fingerprint=fingerprint0 | ||
} | ||
fileSettings = FileSettings {} | ||
platformMisc = PlatformMisc {} | ||
ghcNameVersion = | ||
GhcNameVersion{ghcNameVersion_programName="ghc" | ||
,ghcNameVersion_projectVersion=cProjectVersion | ||
} | ||
platform = | ||
Platform{ | ||
platformWordSize=PW8 | ||
, platformMini=PlatformMini {platformMini_arch=ArchUnknown, platformMini_os=OSUnknown} | ||
, platformUnregisterised=True | ||
} | ||
platformConstants = | ||
PlatformConstants{pc_DYNAMIC_BY_DEFAULT=False,pc_WORD_SIZE=8} | ||
|
||
fakeLlvmConfig :: LlvmConfig | ||
fakeLlvmConfig = LlvmConfig [] [] |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is redundant now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it isn't - it seems I introduced another dependency on this package without knowing. Updated the comment.