-
Notifications
You must be signed in to change notification settings - Fork 21
Add references for pragmas #50
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ import qualified Bag as GHC | |
import qualified BasicTypes as GHC | ||
import qualified DataCon as GHC | ||
import qualified Name as GHC | ||
import BooleanFormula | ||
import FastString (unpackFS) | ||
import GHC | ||
import qualified Id as GHC | ||
|
@@ -506,7 +507,29 @@ refsFromRenamed ctx declAlts (hsGroup, _, _, _) = | |
TypeSig names _ _ -> | ||
#endif | ||
mapMaybe (\(L l n) -> give ctx (nameLocToRef n TypeDecl l)) names | ||
(PatSynSig lnames _) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See universeBi comment below, maybe you can get away with a catch-all clause + biPlate, like other -> (...map magic with nameLocToRef...) universeBi other |
||
lkupSigNames [lnames] | ||
(FixSig (FixitySig lnames _)) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these are cases which were not yet crosslinked, could you also update the tests? At least the GHC backend tests at https://github.com/google/haskell-indexer/blob/master/haskell-indexer-backend-ghc/tests/Language/Haskell/Indexer/Backend/Ghc/Test/TypeLinkTestBase.hs, and optionally the GHC+Kythe end-to-end tests - see https://github.com/google/haskell-indexer/tree/master/kythe-verification/testdata/basic, though for GHC+Kythe the type-link tests are not yet ported. |
||
lkupSigNames lnames | ||
(InlineSig lname _) -> lkupSigNames [lname] | ||
(SpecSig lname ltypes _) -> lkupSigNames [lname] | ||
(SpecInstSig st lst) -> [] | ||
(MinimalSig st lbf) -> lkupSigNames (namesFromLBooleanFormula lbf) | ||
_ -> [] | ||
where | ||
lkupSigNames names = | ||
mapMaybe (\(L l n) -> give ctx (nameLocToRef n Ref l)) names | ||
|
||
namesFromBooleanFormula :: BooleanFormula a -> [a] | ||
namesFromBooleanFormula bf = | ||
case bf of | ||
Var a -> [a] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional: Travelsing this AST seems pretty compact, but consider using *plate. For example:
This might also help unifying changes across GHC versions, trading a bit of performance (which could be gotten back if we would use |
||
And lbfs -> concatMap namesFromLBooleanFormula lbfs | ||
Or lbfs -> concatMap namesFromLBooleanFormula lbfs | ||
Parens lbf -> namesFromLBooleanFormula lbf | ||
|
||
namesFromLBooleanFormula :: LBooleanFormula a -> [a] | ||
namesFromLBooleanFormula (L _ bf) = namesFromBooleanFormula bf | ||
|
||
-- | Exports subclasses/overrides relationships from typeclasses. | ||
relationsFromRenamed :: ExtractCtx -> DeclAltMap -> RenamedSource | ||
|
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.
See outer comment about GHC 7.10 failing.