Commit 71bb7800 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add IntegerConversionRules

Includes a test for the problem in #6111.
parent a6bacc3e
module IntegerConversionRules where
import Data.Word
f1 :: Int -> Double
f1 = fi
f2 :: Int -> Float
f2 = fi
f3 :: Int -> Int
f3 = fi
f4 :: Int -> Word
f4 = fi
fi :: (Integral a, Num b) => a -> b
fi = fromIntegral
......@@ -45,3 +45,14 @@ fromToInteger:
-grep integerToWord fromToInteger.simpl
-grep wordToInteger fromToInteger.simpl
.PHONY: IntegerConversionRules
IntegerConversionRules:
'$(TEST_HC)' -Wall -v0 -O -c $@.hs -fforce-recomp -ddump-simpl > $@.simpl
-grep -q smallInteger $@.simpl && echo "smallInteger present"
-grep -q doubleFromInteger $@.simpl && echo "doubleFromInteger present"
-grep -q int2Double $@.simpl || echo "int2Double absent"
-grep -q floatFromInteger $@.simpl && echo "floatFromInteger present"
-grep -q int2Float $@.simpl || echo "int2Float absent"
-grep -q integerToWord $@.simpl && echo "integerToWord present"
-grep -q int2Word $@.simpl || echo "int2Word absent"
......@@ -8,4 +8,8 @@ test('fromToInteger',
extra_clean(['fromToInteger.simpl']),
run_command,
['$MAKE -s --no-print-directory fromToInteger'])
test('IntegerConversionRules',
extra_clean(['IntegerConversionRules.simpl']),
run_command,
['$MAKE -s --no-print-directory IntegerConversionRules'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment