Open OliverMadine opened 2 years ago
Nag @wz1000 ?
Hi, @wz1000! Any news on that?
I looked into where these duplicate references to data constructors are coming from and here's what I found:
For this example module
module A where
data Foo = Bar { a :: !Int , b :: !Int }
We end up with the following in the refmap here
(Right Bar,
[ (A.hs:2:12-14, Details: Nothing {declaration of constructor bound at: A.hs:2:12-40})
, (A.hs:2:18, Details: Nothing {usage}) -- corresponds to src span of "a" field
, (A.hs:2:30, Details: Nothing {usage}) -- corresponds to src span of "b" field
])
This flat function "flattens" this info into
[ (Right Bar, (A.hs:2:12-14, Details: Nothing {declaration of constructor bound at: A.hs:2:12-40}))
, (Right Bar, (A.hs:2:18, Details: Nothing {usage}))
, (Right Bar, (A.hs:2:30, Details: Nothing {usage}))
]
and we end up with 3 references to Bar constructor, although just one of the 3 identifierDetails in the RefMap was actual reference to the Bar constructor:
@wz1000 I could use some hints on how to proceed. Is it a) a bug in how ghc generates a ref map, including IdentifierDetails under Bar constructors that shouldn't be there? b) a bug in indexing code - which should filter out the constructor fields and only index actual reference to the Bar constructor?
Example
When querying for the
point-refs
at line 1 column 22 (i.e. on thefield
name), theFoo
constructor is given as a reference.Version
This seems to only be an issue with GHC versions >= 9
This is causing haskell-language-server/#2915.