Skip to content

Commit

Permalink
Sort dependencies lexicographically to make predictable what names wi…
Browse files Browse the repository at this point in the history
…ll be exported
  • Loading branch information
facundominguez committed Dec 4, 2024
1 parent 995261c commit a71f969
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion liquidhaskell-boot/src/Language/Haskell/Liquid/Bare.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ makeTargetSpec cfg localVars lnameEnv lmap targetSrc bareSpec dependencies = do
toLegacyDep (sm, ls) = (ModName SrcImport (Ghc.moduleName . Ghc.unStableModule $ sm), fromBareSpecLHName $ unsafeFromLiftedSpec ls)

legacyDependencies :: [(ModName, BareSpec)]
legacyDependencies = map toLegacyDep . M.toList . getDependencies $ dependencies
legacyDependencies =
-- Dependencies are sorted lexicographically to make predictable which
-- logic names will have preference when exporting conflicting measures.
--
-- At the moment it is the measure from the last module after sorting.
-- But if there is a local conflicting measure, that one is used.
L.sortOn fst $ map toLegacyDep $ M.toList $ getDependencies dependencies

-- Assumptions about local functions that are not exported aren't useful for
-- other modules.
Expand Down

0 comments on commit a71f969

Please sign in to comment.