diff options
| author | Bartosz Nitka <niteria@gmail.com> | 2016-01-19 03:25:39 -0800 |
|---|---|---|
| committer | Bartosz Nitka <niteria@gmail.com> | 2016-01-19 03:26:02 -0800 |
| commit | 9d33adb6f352ad4e488067a8756928b3778920e0 (patch) | |
| tree | 506b6ffa5eadb0678d7c1ba22441c46b8d4b3ac9 /compiler/utils/UniqFM.hs | |
| parent | 80265c4c3c827695e92dd9620faf47e064b5da37 (diff) | |
| download | haskell-9d33adb6f352ad4e488067a8756928b3778920e0.tar.gz | |
Check InScopeSet in substTy and provide substTyUnchecked
This adds sanity checks to `substTy` that implement:
> when calling substTy subst ty it should be the case that the in-scope
> set in the substitution is a superset of
> * The free vars of the range of the substitution
> * The free vars of ty minus the domain of the substitution
and replaces violators with unchecked version. The violators were found
by running the GHC test suite.
This ensures that I can work on this incrementally and that what I fix won't
be undone by some other change.
It also includes a couple of fixes that I've already done.
Test Plan: ./validate
Reviewers: simonmar, goldfire, simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1792
GHC Trac Issues: #11371
Diffstat (limited to 'compiler/utils/UniqFM.hs')
| -rw-r--r-- | compiler/utils/UniqFM.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index 9d8669ba04..969e1dc10a 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -48,6 +48,7 @@ module UniqFM ( delFromUFM, delFromUFM_Directly, delListFromUFM, + delListFromUFM_Directly, plusUFM, plusUFM_C, plusUFM_CD, @@ -138,6 +139,7 @@ adjustUFM_Directly :: (elt -> elt) -> UniqFM elt -> Unique -> UniqFM elt delFromUFM :: Uniquable key => UniqFM elt -> key -> UniqFM elt delListFromUFM :: Uniquable key => UniqFM elt -> [key] -> UniqFM elt +delListFromUFM_Directly :: UniqFM elt -> [Unique] -> UniqFM elt delFromUFM_Directly :: UniqFM elt -> Unique -> UniqFM elt -- Bindings in right argument shadow those in the left @@ -252,6 +254,7 @@ adjustUFM_Directly f (UFM m) u = UFM (M.adjust f (getKey u) m) delFromUFM (UFM m) k = UFM (M.delete (getKey $ getUnique k) m) delListFromUFM = foldl delFromUFM delFromUFM_Directly (UFM m) u = UFM (M.delete (getKey u) m) +delListFromUFM_Directly = foldl delFromUFM_Directly -- M.union is left-biased, plusUFM should be right-biased. plusUFM (UFM x) (UFM y) = UFM (M.union y x) |
