Commit b6dc319a authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan Committed by Marge Bot

Add regression test for #12760

The bug seems to be fixed in the meantime, make sure it stays fixed.

Closes #12760
parent c95920a6
Pipeline #15565 passed with stages
in 676 minutes and 45 seconds
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module A where
import Data.List (minimumBy)
import Data.Ord (comparing)
data A a = A Int
newtype B = B Double
deriving (Eq,Ord,Num,Real,Fractional,RealFrac,Floating,RealFloat)
class C a where
_c :: [a] -> D a
instance C B where
_c = f2 u
data D x = D [(x,Double)] [ x ]
u = undefined
f1 :: RealFloat a => A a -> a -> [a] -> D a
f1 (A a1) m ps0 = D (zip tickvs []) labelvs
where
range _ | m == m = if m==0 then (-1,1) else (m, m)
labelvs = map fromRational $ f3 (fromIntegral a1) (range ps0)
tickvs = map fromRational $ f3 (fromIntegral a1) (head labelvs, head labelvs)
f2 :: RealFloat a => A a -> [a] -> D a
f2 lap ps = f1 u (minimum ps) ps
f3 :: RealFloat a => a -> (a,a) -> [Rational]
f3 k rs@(m,_ ) = map ((s*) . fromIntegral) [floor m .. ]
where
s = minimumBy (comparing ((+ k) . realToFrac)) [0]
......@@ -693,3 +693,4 @@ test('T15839a', normal, compile, [''])
test('T15839b', normal, compile, [''])
test('T17343', exit_code(1), compile_and_run, [''])
test('T17566', [extra_files(['T17566a.hs'])], makefile_test, [])
test('T12760', unless(compiler_debugged(), skip), compile, ['-O'])
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