Skip to content

Commit 9c72cae

Browse files
committed
change code.hs.Entity
1 parent 304f047 commit 9c72cae

File tree

12 files changed

+2402
-1841
lines changed

12 files changed

+2402
-1841
lines changed

glean/glass/Glean/Glass/Search/Haskell.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ symbolIdQuery
5959
-> Angle (ResultLocation Haskell.Entity)
6060
symbolIdQuery _pkg mod ident ns sort =
6161
vars $ \name file span ->
62-
tuple (name, file, sig (alt @"span" span :: Angle Code.RangeSpan), string ident)
63-
`where_` [
62+
tuple (
63+
alt @"name" (asPredicate name),
64+
file,
65+
alt @"span" span,
66+
string ident
67+
) `where_` [
6468
name .= predicate @Hs.Name (
6569
rec $
6670
field @"occ" (rec $

glean/glass/Glean/Glass/SymbolId/Hs.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ import TextShow
1616

1717
import Glean.Glass.SymbolId.Class
1818
import Glean.Glass.Types (Name(..))
19-
import Glean.Schema.CodeHs.Types as Hs (Entity)
19+
import Glean.Schema.CodeHs.Types as Hs (Entity(..))
2020
import qualified Glean
2121
import qualified Glean.Schema.Hs.Types as Hs
2222
import qualified Glean.Schema.Src.Types as Src
2323

2424
-- REPO/hs/containers/Data/Map/{var|datacon|tyvar|tycon}/toList[/START/END]
2525

2626
instance Symbol Hs.Entity where
27-
toSymbol = toSymbolPredicate
27+
toSymbol (Hs.Entity_name x) = toSymbolPredicate x
28+
toSymbol (Hs.Entity_mod x) = toSymbolPredicate x
29+
toSymbol _ = error "toSymbol: unknown Hs.Entity"
2830

2931
instance Symbol Hs.Name_key where
3032
toSymbol (Hs.Name_key occ mod sort) = do
@@ -66,12 +68,15 @@ instance Symbol Hs.NameSort where
6668
toSymbol Hs.NameSort_external{} = return []
6769
toSymbol (Hs.NameSort_internal (Src.ByteSpan start end)) =
6870
return [showt (Glean.fromNat start), showt (Glean.fromNat end)]
71+
toSymbol _ = error "toSymbol: unknown Hs.NameSort"
6972

7073
instance ToQName Hs.Entity where
71-
toQName n = Glean.keyOf n >>= toQName
74+
toQName (Hs.Entity_name n) = Glean.keyOf n >>= toQName
75+
toQName (Hs.Entity_mod _) = error "TODO: ToQName Hs.Entity_mod"
76+
toQName _ = error "ToQName: unknown Hs.Entity"
7277

7378
instance ToQName Hs.Name_key where
74-
toQName (Hs.Name_key occ mod sort) = do
79+
toQName (Hs.Name_key occ mod _sort) = do
7580
Hs.Module_key m _ <- Glean.keyOf mod
7681
modname <- Glean.keyOf m
7782
Hs.OccName_key n _ <- Glean.keyOf occ

0 commit comments

Comments
 (0)