diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/printer/Makefile | 6 | ||||
-rw-r--r-- | testsuite/tests/printer/Test20243.hs | 42 | ||||
-rw-r--r-- | testsuite/tests/printer/all.T | 1 |
3 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index 4d2dad7b86..ef8aa2858a 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -729,6 +729,12 @@ PprCommentPlacement2: $(CHECK_PPR) $(LIBDIR) PprCommentPlacement2.hs $(CHECK_EXACT) $(LIBDIR) PprCommentPlacement2.hs + +.PHONY: Test20243 +Test20243: + $(CHECK_PPR) $(LIBDIR) Test20243.hs + $(CHECK_EXACT) $(LIBDIR) Test20243.hs + .PHONY: Test20258 Test20258: $(CHECK_PPR) $(LIBDIR) Test20258.hs diff --git a/testsuite/tests/printer/Test20243.hs b/testsuite/tests/printer/Test20243.hs new file mode 100644 index 0000000000..b78591f42d --- /dev/null +++ b/testsuite/tests/printer/Test20243.hs @@ -0,0 +1,42 @@ +{-# LANGUAGE NPlusKPatterns #-} +module Test20243 where + +singleline :: Integer -> Integer +singleline (n + 1) = n + +multiline :: Integer -> Integer +multiline(n + + 1) = n + +m :: Integer +(m + 1) = 3 + +erroR :: Int +erroR = n where + (n+1,_) = (5,2) + +g :: Int -> Int +g (x+1) = x +g y = y +g _ = 0 -- Overlapped + +h :: Int -> Int +h (x+1) = x +h _ = 0 -- Not overlapped + +kh (n+2) x | x > n = x * 2 +kh (x+1) (m+1) = m + +takeList :: Int -> [a] -> [a] +takeList 0 _ = [] +takeList (n+1) [] = [] +takeList (n+1) (x:xs) = x : takeList n xs + +(^^^^) :: (Num a, Integral b) => a -> b -> a +x ^^^^ 0 = 1 +x ^^^^ (n+1) = f x n x + where f _ 0 y = y + f x n y = g x n where + g x n | even n = g (x*x) (n `quot` 2) + | otherwise = f x (n-1) (x*y) +_ ^^^^ _ = error "(^^^^){prelude}: negative exponent" diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index 4b9c04c01c..380e71c723 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -170,4 +170,5 @@ test('PprBracesSemiDataDecl', ignore_stderr, makefile_test, ['PprBracesSemiDataD test('PprUnicodeSyntax', ignore_stderr, makefile_test, ['PprUnicodeSyntax']) test('PprCommentPlacement2', ignore_stderr, makefile_test, ['PprCommentPlacement2']) +test('Test20243', ignore_stderr, makefile_test, ['Test20243']) test('Test20258', ignore_stderr, makefile_test, ['Test20258']) |