diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-01-27 19:44:04 +0100 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-01-27 19:45:18 +0100 |
commit | 5e9c8d1bcefbec8b4d7281065834ccdc43ae731d (patch) | |
tree | 12843482ae24c5ab0d0221b89049303bceda460c | |
parent | 34a8a0e4cf188a30d2b4b65909f24185c80d071e (diff) | |
download | haskell-wip/fix-check-uniques.tar.gz |
Fix check-uniques scriptwip/fix-check-uniques
It was checking the old path compiler/prelude/*, outdated with the new module
hierarchy. I added a sanity check to avoid this in the future.
-rwxr-xr-x | utils/checkUniques/check-uniques.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/checkUniques/check-uniques.py b/utils/checkUniques/check-uniques.py index de71e72c14..dd5891b0d8 100755 --- a/utils/checkUniques/check-uniques.py +++ b/utils/checkUniques/check-uniques.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function import os.path import sys import re @@ -14,11 +13,8 @@ def find_uniques(source_files): unique_re = re.compile(r"([\w\d]+)\s*=\s*mk([\w\d']+)Unique\s+(\d+)") for f in source_files: ms = unique_re.findall(io.open(f, encoding='utf8').read()) - for m in ms: - name = m[0] - _type = m[1] - n = int(m[2]) - uniques[_type][n].add(name) + for name, _type, n in ms: + uniques[_type][int(n)].add(name) return uniques @@ -37,9 +33,13 @@ def find_conflicts(uniques): ] top_dir = sys.argv[1] -uniques = find_uniques(glob.glob(os.path.join(top_dir, 'compiler', 'prelude', '*.hs'))) +uniques = find_uniques(glob.glob(os.path.join(top_dir, 'compiler', 'GHC', '**', '*.hs'), recursive=True)) #print_all(uniques) conflicts = find_conflicts(uniques) +if len(uniques) < 5: + print("Error: check-uniques: run from wrong directory?") + sys.exit(1) + if len(conflicts) > 0: print("Error: check-uniques: Found Unique conflict") print() |