summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-05-17 09:44:46 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-05-17 09:47:21 +0100
commitd6461f9684f6f758320a5e5afbf0634fcc2996a5 (patch)
tree746371a7a1dc34d12433e7e82a95ede213506a7b /testsuite/tests
parentd9e9a9b3016a05e6153de3803998877f91c6cdf4 (diff)
downloadhaskell-d6461f9684f6f758320a5e5afbf0634fcc2996a5.tar.gz
Handle type-lets better
Core allows non-recursive type-lets, thus let a = TYPE ty in ... They are substituted away very quickly, but it's convenient for some passes to produce them (rather than to have to substitute immediately). Trac #13708 tried the effect of not running the simplifer at all (a rather bizarre thing to do, but still). That showed that some passes crashed because they always treated a let-bounder binder as an Id. This patch adds some easy fixes.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/simplCore/should_compile/T13708.hs11
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T13708.hs b/testsuite/tests/simplCore/should_compile/T13708.hs
new file mode 100644
index 0000000000..43f42bc4d0
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13708.hs
@@ -0,0 +1,11 @@
+{-# OPTIONS_GHC -O -fmax-simplifier-iterations=0 #-}
+
+-- Not running the simplifier leads to type-lets persisting longer
+
+module T13708 where
+
+indexOr :: a -> Int -> [a] -> a
+indexOr fallback idx xs =
+ if (idx < length xs)
+ then xs !! idx
+ else fallback
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 5ed520d597..f4f22b9dc5 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -269,3 +269,4 @@ test('T12600',
run_command,
['$MAKE -s --no-print-directory T12600'])
test('T13658', normal, compile, ['-dcore-lint'])
+test('T13708', normal, compile, [''])