diff options
author | Wojciech Baranowski <wbaranowski@protonmail.com> | 2019-04-07 19:25:05 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-29 21:02:38 -0400 |
commit | 2c115085982ba19985f2e00ca938370647e38e4b (patch) | |
tree | 68027543c668f37e65e9a8cbda5a7e69536a64ba /testsuite/tests/rename | |
parent | 0040af598865733e6565530f4b036e11563976fc (diff) | |
download | haskell-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/tests/rename')
-rw-r--r-- | testsuite/tests/rename/should_fail/T16504.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T16504.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 |
3 files changed, 31 insertions, 0 deletions
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, ['']) |