diff options
author | Oscar NihlgÄrd <oscarnihlgard@gmail.com> | 2018-02-24 14:56:17 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-02-24 14:56:17 +0100 |
commit | e4515f304abf9b9ce029b634b38fce2a398a16fc (patch) | |
tree | 6d37b5c7fddaa27c4fdb1bf80b8c091dec80f383 /compiler/nimsets.nim | |
parent | ba6e11fc888c0e8171797f5af731e6ac6b16c8e6 (diff) | |
download | Nim-e4515f304abf9b9ce029b634b38fce2a398a16fc.tar.gz |
Improve semchecking for duplicate cases in case statements (#7176)
* Improve semchecking for duplicate cases in case statements * Revert to previous solution * Improve test
Diffstat (limited to 'compiler/nimsets.nim')
-rw-r--r-- | compiler/nimsets.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/nimsets.nim b/compiler/nimsets.nim index 94507adf0..bda753e85 100644 --- a/compiler/nimsets.nim +++ b/compiler/nimsets.nim @@ -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 |