summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorWojciech Baranowski <wbaranowski@protonmail.com>2019-04-07 19:25:05 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-29 21:02:38 -0400
commit2c115085982ba19985f2e00ca938370647e38e4b (patch)
tree68027543c668f37e65e9a8cbda5a7e69536a64ba /testsuite
parent0040af598865733e6565530f4b036e11563976fc (diff)
downloadhaskell-2c115085982ba19985f2e00ca938370647e38e4b.tar.gz
rename: hadle type signatures with typos
When encountering type signatures for unknown names, suggest similar alternatives. This fixes issue #16504
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stderr2
-rw-r--r--testsuite/tests/rename/should_fail/T16504.hs16
-rw-r--r--testsuite/tests/rename/should_fail/T16504.stderr14
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
4 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr b/testsuite/tests/parser/should_fail/readFail001.stderr
index 6425d16c49..0b6d4b4d29 100644
--- a/testsuite/tests/parser/should_fail/readFail001.stderr
+++ b/testsuite/tests/parser/should_fail/readFail001.stderr
@@ -1,6 +1,8 @@
readFail001.hs:25:11: error:
The fixity signature for ‘+#’ lacks an accompanying binding
+ Perhaps you meant ‘+’ (Defined in ‘GHC.Num’)
+ Perhaps you meant ‘++’ (Defined in ‘GHC.Base’)
readFail001.hs:38:32: error:
Not in scope: type constructor or class ‘Leaf’
diff --git a/testsuite/tests/rename/should_fail/T16504.hs b/testsuite/tests/rename/should_fail/T16504.hs
new file mode 100644
index 0000000000..1bb6a08226
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T16504.hs
@@ -0,0 +1,16 @@
+-- Type signature and definition with name typo
+module M where
+
+-- Both in global scope
+simpleFuntcion :: Int -> Bool
+simpleFunction i = i > 5
+
+-- Both in local scope
+f x = anotherFunction x
+ where anotherFunction :: Int -> Bool
+ anotherFuntcion i = i > 5
+
+-- Global signature, local definition
+nonexistentFuntcion :: Int -> Bool
+g x = nonexistentFunction x
+ where nonexistentFunction i = i > 5
diff --git a/testsuite/tests/rename/should_fail/T16504.stderr b/testsuite/tests/rename/should_fail/T16504.stderr
new file mode 100644
index 0000000000..7bc59bda3e
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T16504.stderr
@@ -0,0 +1,14 @@
+
+T16504.hs:5:1: error:
+ The type signature for ‘simpleFuntcion’
+ lacks an accompanying binding
+ Perhaps you meant ‘simpleFunction’ (Defined at T16504.hs:6:1)
+
+T16504.hs:10:9: error:
+ The type signature for ‘anotherFunction’
+ lacks an accompanying binding
+ Perhaps you meant ‘anotherFuntcion’ (Defined at T16504.hs:11:9)
+
+T16504.hs:14:1: error:
+ The type signature for ‘nonexistentFuntcion’
+ lacks an accompanying binding
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 5bfded171f..52a4f45a04 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -148,3 +148,4 @@ test('T16116b', normal, compile_fail, [''])
test('ExplicitForAllRules2', normal, compile_fail, [''])
test('T15957_Fail', normal, compile_fail, ['-Werror -Wall -Wno-missing-signatures'])
test('T16385', normal, compile_fail, [''])
+test('T16504', normal, compile_fail, [''])