From cb5271ac9a6686d065de63d1dde80e713830e21b Mon Sep 17 00:00:00 2001
From: Kevin Buhr <buhr@asaurus.net>
Date: Tue, 7 May 2019 11:01:14 -0500
Subject: [PATCH] Add regression test for old panic on inlining undeclared
 identifier (#495)

---
 testsuite/tests/rename/should_fail/T495.hs     | 7 +++++++
 testsuite/tests/rename/should_fail/T495.stderr | 7 +++++++
 testsuite/tests/rename/should_fail/all.T       | 1 +
 3 files changed, 15 insertions(+)
 create mode 100644 testsuite/tests/rename/should_fail/T495.hs
 create mode 100644 testsuite/tests/rename/should_fail/T495.stderr

diff --git a/testsuite/tests/rename/should_fail/T495.hs b/testsuite/tests/rename/should_fail/T495.hs
new file mode 100644
index 000000000000..7fa871dfdb56
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T495.hs
@@ -0,0 +1,7 @@
+-- Regression test for #495
+
+-- inlining an undeclared identifier should give error, not panic...
+{-# INLINE blarg #-}
+
+-- even if the identifier is imported in the Prelude...
+{-# INLINE lookup #-}
diff --git a/testsuite/tests/rename/should_fail/T495.stderr b/testsuite/tests/rename/should_fail/T495.stderr
new file mode 100644
index 000000000000..0581807d7028
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T495.stderr
@@ -0,0 +1,7 @@
+
+T495.hs:4:12: error:
+    The INLINE pragma for ‘blarg’ lacks an accompanying binding
+
+T495.hs:7:12: error:
+    The INLINE pragma for ‘lookup’ lacks an accompanying binding
+      (The INLINE pragma must be given where ‘lookup’ is declared)
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 35a317400016..c36c4cfcf97f 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -60,6 +60,7 @@ test('rnfail056', normal, compile_fail, [''])
 test('rnfail057', normal, compile_fail, [''])
 
 test('rn_dup', normal, compile_fail, [''])
+test('T495', normal, compile_fail, [''])
 test('T2490', normal, compile_fail, [''])
 test('T2901', normal, compile_fail, [''])
 test('T2723', normal, compile, [''])  # Warnings only
-- 
GitLab