Improve semchecking for duplicate cases in case statements (#7176)

* Improve semchecking for duplicate cases in case statements

* Revert to previous solution

* Improve test
This commit is contained in:
Oscar Nihlgård 2018-02-24 14:56:17 +01:00 • committed by Andreas Rumpf
commit e4515f304a
3 changed files with 66 additions and 4 deletions

View file

@ -151,6 +151,11 @@ proc complement*(a: PNode): PNode =
for i in countup(0, high(x)): x[i] = not x[i]
result = toTreeSet(x, a.typ, a.info)
proc deduplicate*(a: PNode): PNode =
var x: TBitSet
toBitSet(a, x)
result = toTreeSet(x, a.typ, a.info)
proc cardSet(s: PNode): BiggestInt =
# here we can do better than converting it into a compact set
# we just count the elements directly