Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mpickering
Copy link
Contributor

This patch adds reference for things like INLINE pragmas.

I tested it by running the indexer on lens and observing that the INLINE pragmas are now linked as expected.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@mpickering
Copy link
Contributor Author

I signed the CLA.

@googlebot
Copy link

CLAs look good, thanks!

@robinp
Copy link
Collaborator

robinp commented Jul 20, 2017

Seems like GHC 7.10 is not happy: https://travis-ci.org/google/haskell-indexer/builds/255296634?utm_source=github_status&utm_medium=notification

[4 of 5] Compiling Language.Haskell.Indexer.Backend.Ghc ( src/Language/Haskell/Indexer/Backend/Ghc.hs, dist/build/Language/Haskell/Indexer/Backend/Ghc.o )
src/Language/Haskell/Indexer/Backend/Ghc.hs:529:5:
Not in scope: data constructor ‘Parens’
Perhaps you meant variable ‘GHC.parens’ (imported from Outputable)
src/Language/Haskell/Indexer/Backend/Ghc.hs:531:29:
Not in scope: type constructor or class ‘LBooleanFormula’
Perhaps you meant ‘BooleanFormula’ (imported from BooleanFormula)

For the time being, could you add ifdefs (see the file for others)?

Copy link
Collaborator

@robinp robinp left a comment

Choose a reason for hiding this comment

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

Thank you for this PR! Please see some comments.

@@ -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
Copy link
Collaborator

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.

namesFromBooleanFormula :: BooleanFormula a -> [a]
namesFromBooleanFormula bf =
case bf of
Var a -> [a]
Copy link
Collaborator

Choose a reason for hiding this comment

The 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:

let allNames = universeBi aBooleanFormula

This might also help unifying changes across GHC versions, trading a bit of performance (which could be gotten back if we would use Data.Data.Lens and pull in lens, but benchmarking needed).

@@ -506,7 +507,29 @@ refsFromRenamed ctx declAlts (hsGroup, _, _, _) =
TypeSig names _ _ ->
#endif
mapMaybe (\(L l n) -> give ctx (nameLocToRef n TypeDecl l)) names
(PatSynSig lnames _) ->
Copy link
Collaborator

Choose a reason for hiding this comment

The 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

@@ -506,7 +507,29 @@ refsFromRenamed ctx declAlts (hsGroup, _, _, _) =
TypeSig names _ _ ->
#endif
mapMaybe (\(L l n) -> give ctx (nameLocToRef n TypeDecl l)) names
(PatSynSig lnames _) ->
lkupSigNames [lnames]
(FixSig (FixitySig lnames _)) ->
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

@robinp
Copy link
Collaborator

robinp commented Oct 2, 2019

@mpickering do you plan to flesh out this change, or would you prefer if someone took over?

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.

3 participants