Comments (2)
I added some comments on the slightly related #19 .
A quick summary of the current state after quickly checking https://github.com/google/haskell-indexer/blob/master/kythe-verification/testdata/basic/RecordReadRef.hs - correct me if it is wrong:
-
now a non-literal deconstruction like
bar (Foo a _) = ...
will only emit a binding fora
, and connect the usages ofa
to it. There isn't any edge going from either the binding span or the ref spans to the field. (this is why @blackgnezdo opened the issue). -
explicitly named deconstruction like
bar Foo { x = a } = ...
will connectx
to the field binding. Usages ofa
won't be listed in the backrefs for fieldx
. -
punned deconstruction like
bar Foo {x}
won't introduce a local binding (?), both the pattern and the usages will directly reference the field binding. Which is a bit odd highlight-wise and semantically (say, allx
refs in the file are hilit even when hovering a local usage in a single function?), but at least brings the usages in the backref. -
For non-record constructor
data Bar = Bar Int
, not sure - maybe we don't even emit a field decl at the span ofInt
(?), so implicit matches don't even have the target to reference.
IMO, a user generally wants to see how a field is used in a specific context when looking through the backreferences. The various cases are:
-
current punning refs in (3) are not semantically nice, but bring the backref
-
for (1), (2) and (4), adding an edge from the pattern-matched name to the field would bring them in the backrefs, but if the pattern name would differ from the field name, the listing could look odd (the UI can solve this by bolding the reference in the listed line to resolve ambiguity)
As a unified solution, my gut feeling is that a local usage of a deconstructed var should directly reference both the local binding and the generic field binding in the data definition.
from haskell-indexer.
See discussion in kythe/kythe#3934 - TLDR the local binding should bind a variable/import
node (maybe the subkind is not important, could be left or be field
as well?), which should have an aliases
edge towards the generic field binding. The index preprocessor (with appropriate config) will merge the backrefs for the local usage into the field's usage.
/cc @zrlk to verify I understand correctly
from haskell-indexer.
Related Issues (20)
- Add pseudo-xrefs for implicitly imported entities HOT 3
- Migrate to proto-lens 0.5
- Cover all the constructor names in GADT HOT 1
- Wire up kythe verification tests to Travis CI
- Add indexing support for Haskell TypeOperators
- Make entities from core packages linked to hackage documents
- Don't emit anchor childof file edges HOT 1
- Refined variable subkinds
- Provide full definition spans in Haskell
- Cross-references in import/export lists when a whole module is imported/exported HOT 1
- Duplicate anchors when type variables exist in type signatures HOT 5
- Add doc/uri references to core modules
- Not all xrefs are indexed for type operators
- Special-case lenses from makeLenses to link to field definition HOT 1
- Support GHC 8.10 HOT 1
- Return unchanged GHC errors to the caller
- Initialize plugins for ghc-8.6
- Remove support for GHC < 8.6 HOT 4
- Clean up build warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell-indexer.