Skip to content

Commit d1460d6

Browse files
committed
Filter out constructors and ability requests in the process of computing a diff.
1 parent ce7ceb2 commit d1460d6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Share/Postgres/NamespaceDiffs.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Share.Postgres.IDs (BranchHashId)
1313
import Share.Postgres.NameLookups.Types (NameLookupReceipt, NamedRef (..), ReversedName)
1414
import Share.Postgres.Refs.Types (PGReference, PGReferent)
1515
import Share.Prelude
16+
import U.Codebase.Referent qualified as V2
1617
import Unison.Name (Name)
1718
import Unison.Util.Relation (Relation)
1819
import Unison.Util.Relation qualified as Rel
@@ -106,6 +107,21 @@ getRelevantTermsForDiff !_nameLookupReceipt oldBranchHashId newBranchHashId = do
106107
SELECT new.reversed_name, new.referent_builtin, new.referent_component_hash_id, new.referent_component_index, new.referent_constructor_index, true
107108
FROM relevant_terms_in_new new
108109
|]
110+
-- NOTE: For now we filter out all diffs on constructors.
111+
-- This is because:
112+
-- 1. We don't have a good way to construct a reasonable looking diff if a constructor
113+
-- is updated into a term
114+
-- 2. It's silly to render a change in a type in both the type itself AND all of its
115+
-- constructors
116+
--
117+
-- The downside is that this means if a constructor is only _renamed_ but not otherwise
118+
-- changed, it won't show up in the diff at all :'( , but we plan to fix this with the new
119+
-- synhash based diffing system.
120+
<&> filter
121+
( \(NamedRef {ref} PG.:. _) -> case ref of
122+
V2.Ref {} -> True
123+
V2.Con {} -> False
124+
)
109125
<&> ( fmap \(NamedRef {reversedSegments, ref} PG.:. PG.Only inNew) ->
110126
if inNew
111127
then Right (from @ReversedName @Name reversedSegments, ref)

0 commit comments

Comments
 (0)