Fix and document Unique generation for sum TyCon and DataCons
[ghc.git] / testsuite / tests / unboxedsums / unboxedsums_unit_tests.hs
1 module Main where
2
3 import TysWiredIn
4 import UniqSet
5 import Unique
6
7 import System.IO
8 import Control.Monad
9
10 main :: IO ()
11 main = sequence_
12 [ uniq_tests ]
13
14
15 uniq_tests :: IO ()
16 uniq_tests = do
17 let tycons = map sumTyCon [2 .. 20]
18 datacons = [ sumDataCon alt arity | arity <- [ 2 .. 20 ]
19 , alt <- [ 1 .. arity ] ]
20
21 us = mkUniqSet (map getUnique tycons)
22 `unionUniqSets` mkUniqSet (map getUnique datacons)
23
24 when (sizeUniqSet us /= length tycons + length datacons) $ do
25 hPutStrLn stderr "Sum cons/tycons have same uniques."
26 hFlush stderr