Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Sep 18, 2024
1 parent 48c0348 commit 04cef0c
Show file tree
Hide file tree
Showing 35 changed files with 177 additions and 93 deletions.
45 changes: 39 additions & 6 deletions vim/sensei.test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ for name in glob("vim/test/assets/lexical-error.hs.*.errors", v:true, v:true)
call assert_equal(1, len(errors))

let err = errors[0]
call assert_equal("vim/test/assets/lexical-error.hs", bufname(err.bufnr))
call assert_equal("lexical-error.hs", bufname(err.bufnr))
call assert_equal(1, err.lnum)
call assert_equal(11, err.col)
call assert_equal(0, err.end_lnum)
Expand All @@ -45,7 +45,7 @@ for name in glob("vim/test/assets/parse-error.hs.*.errors", v:true, v:true)
call assert_equal(1, len(errors))

let err = errors[0]
call assert_equal("vim/test/assets/parse-error.hs", bufname(err.bufnr))
call assert_equal("parse-error.hs", bufname(err.bufnr))
call assert_equal(1, err.lnum)
call assert_equal(1, err.col)
call assert_equal(0, err.end_lnum)
Expand All @@ -64,7 +64,7 @@ for name in glob("vim/test/assets/type-error.hs.*.errors", v:true, v:true)
call assert_equal(1, len(errors))

let err = errors[0]
call assert_equal("vim/test/assets/type-error.hs", bufname(err.bufnr))
call assert_equal("type-error.hs", bufname(err.bufnr))
call assert_equal(2, err.lnum)
call assert_equal(7, err.col)
call assert_equal(0, err.end_lnum)
Expand All @@ -79,12 +79,12 @@ for name in glob("vim/test/assets/type-error.hs.*.errors", v:true, v:true)
endif
endfor

for name in glob("vim/test/assets/type-signature-lacks-binding.hs.*.errors", v:true, v:true)
for name in glob("vim/test/assets/suggested-fix.hs.*.errors", v:true, v:true)
let errors = PopulateQuickFixList(name)
call assert_equal(2, len(errors))

let err = errors[0]
call assert_equal("vim/test/assets/type-signature-lacks-binding.hs", bufname(err.bufnr))
call assert_equal("suggested-fix.hs", bufname(err.bufnr))
call assert_equal(1, err.lnum)
call assert_equal(1, err.col)
call assert_equal(0, err.end_lnum)
Expand All @@ -98,7 +98,40 @@ for name in glob("vim/test/assets/type-signature-lacks-binding.hs.*.errors", v:t
call assert_equal("\n The type signature for ‘foo’ lacks an accompanying binding", err.text)

let err = errors[1]
call assert_equal("vim/test/assets/type-signature-lacks-binding.hs", bufname(err.bufnr))
call assert_equal("suggested-fix.hs", bufname(err.bufnr))
call assert_equal(4, err.lnum)
call assert_equal(1, err.col)
call assert_equal(0, err.end_lnum)
call assert_equal(0, err.end_col)
call assert_equal('e', err.type)
if Require(GhcVersion(name), [9,6])
call assert_equal(44432, err.nr)
else
call assert_equal(-1, err.nr)
endif
call assert_equal("\n The type signature for ‘bar’ lacks an accompanying binding", err.text)
endfor

for name in glob("vim/test/assets/suggested-fix-multiline.hs.*.errors", v:true, v:true)
let errors = PopulateQuickFixList(name)
call assert_equal(2, len(errors))

let err = errors[0]
call assert_equal("suggested-fix-multiline.hs", bufname(err.bufnr))
call assert_equal(1, err.lnum)
call assert_equal(1, err.col)
call assert_equal(0, err.end_lnum)
call assert_equal(0, err.end_col)
call assert_equal('e', err.type)
if Require(GhcVersion(name), [9,6])
call assert_equal(44432, err.nr)
else
call assert_equal(-1, err.nr)
endif
call assert_equal("\n The type signature for ‘foo’ lacks an accompanying binding", err.text)

let err = errors[1]
call assert_equal("suggested-fix-multiline.hs", bufname(err.bufnr))
call assert_equal(4, err.lnum)
call assert_equal(1, err.col)
call assert_equal(0, err.end_lnum)
Expand Down
9 changes: 5 additions & 4 deletions vim/test/assets/generate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
cabal exec -- runhaskell vim/test/assets/hspec.hs --expert --seed 0 > vim/test/assets/hspec.hs.errors
sed -i 's/Finished in 0.000[0-9] seconds/Finished in 0.0005 seconds/' vim/test/assets/hspec.hs.errors

cd vim/test/assets

for name in $(find vim/test/assets/ -name '*.hs' ! -name '*hspec*'); do
for name in $(ls *.hs | grep -v hspec); do
for ghc in ghc-9.6 ghc-9.8 ghc-9.10; do
if command -v "$ghc" >/dev/null 2>&1; then
$ghc -fno-diagnostics-show-caret -fno-show-error-context "$name" &> "$name.ghc-$($ghc --numeric-version).errors"
Expand All @@ -12,6 +16,3 @@ for name in $(find vim/test/assets/ -name '*.hs' ! -name '*hspec*'); do
fi
done
done

cabal exec -- runhaskell vim/test/assets/hspec.hs --expert --seed 0 > vim/test/assets/hspec.hs.errors
sed -i 's/Finished in 0.000[0-9] seconds/Finished in 0.0005 seconds/' vim/test/assets/hspec.hs.errors
4 changes: 2 additions & 2 deletions vim/test/assets/lexical-error.hs.ghc-9.10.1.errors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o )
vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231]
[1 of 2] Compiling Main ( lexical-error.hs, lexical-error.o )
lexical-error.hs:1:11: error: [GHC-21231]
lexical error in string/character literal at character '\n'

4 changes: 2 additions & 2 deletions vim/test/assets/lexical-error.hs.ghc-9.2.8.errors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[1 of 1] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o )
[1 of 1] Compiling Main ( lexical-error.hs, lexical-error.o )

vim/test/assets/lexical-error.hs:1:11: error:
lexical-error.hs:1:11: error:
lexical error in string/character literal at character '\n'
4 changes: 2 additions & 2 deletions vim/test/assets/lexical-error.hs.ghc-9.4.8.errors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o )
[1 of 2] Compiling Main ( lexical-error.hs, lexical-error.o )

vim/test/assets/lexical-error.hs:1:11: error:
lexical-error.hs:1:11: error:
lexical error in string/character literal at character '\n'
4 changes: 2 additions & 2 deletions vim/test/assets/lexical-error.hs.ghc-9.6.6.errors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o )
[1 of 2] Compiling Main ( lexical-error.hs, lexical-error.o )

vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231]
lexical-error.hs:1:11: error: [GHC-21231]
lexical error in string/character literal at character '\n'
4 changes: 2 additions & 2 deletions vim/test/assets/lexical-error.hs.ghc-9.8.2.errors
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o )
[1 of 2] Compiling Main ( lexical-error.hs, lexical-error.o )

vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231]
lexical-error.hs:1:11: error: [GHC-21231]
lexical error in string/character literal at character '\n'
4 changes: 2 additions & 2 deletions vim/test/assets/parse-error.hs.ghc-9.10.1.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o )
vim/test/assets/parse-error.hs:1:1: error: [GHC-25277]
[1 of 2] Compiling Main ( parse-error.hs, parse-error.o )
parse-error.hs:1:1: error: [GHC-25277]
Parse error: module header, import declaration
or top-level declaration expected.

4 changes: 2 additions & 2 deletions vim/test/assets/parse-error.hs.ghc-9.2.8.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 1] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o )
[1 of 1] Compiling Main ( parse-error.hs, parse-error.o )

vim/test/assets/parse-error.hs:1:1: error:
parse-error.hs:1:1: error:
Parse error: module header, import declaration
or top-level declaration expected.
4 changes: 2 additions & 2 deletions vim/test/assets/parse-error.hs.ghc-9.4.8.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o )
[1 of 2] Compiling Main ( parse-error.hs, parse-error.o )

vim/test/assets/parse-error.hs:1:1: error:
parse-error.hs:1:1: error:
Parse error: module header, import declaration
or top-level declaration expected.
4 changes: 2 additions & 2 deletions vim/test/assets/parse-error.hs.ghc-9.6.6.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o )
[1 of 2] Compiling Main ( parse-error.hs, parse-error.o )

vim/test/assets/parse-error.hs:1:1: error:
parse-error.hs:1:1: error:
Parse error: module header, import declaration
or top-level declaration expected.
4 changes: 2 additions & 2 deletions vim/test/assets/parse-error.hs.ghc-9.8.2.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o )
[1 of 2] Compiling Main ( parse-error.hs, parse-error.o )

vim/test/assets/parse-error.hs:1:1: error: [GHC-25277]
parse-error.hs:1:1: error: [GHC-25277]
Parse error: module header, import declaration
or top-level declaration expected.
File renamed without changes.
11 changes: 11 additions & 0 deletions vim/test/assets/suggested-fix-multiline.hs.ghc-9.10.1.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[1 of 2] Compiling Main ( suggested-fix-multiline.hs, suggested-fix-multiline.o )
suggested-fix-multiline.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘foo_’ (Defined at suggested-fix-multiline.hs:2:1)

suggested-fix-multiline.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘bar_’ (Defined at suggested-fix-multiline.hs:5:1)

9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix-multiline.hs.ghc-9.2.8.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 1] Compiling Main ( suggested-fix-multiline.hs, suggested-fix-multiline.o )

suggested-fix-multiline.hs:1:1: error:
The type signature for ‘foo’ lacks an accompanying binding
Perhaps you meant ‘foo_’ (Defined at suggested-fix-multiline.hs:2:1)

suggested-fix-multiline.hs:4:1: error:
The type signature for ‘bar’ lacks an accompanying binding
Perhaps you meant ‘bar_’ (Defined at suggested-fix-multiline.hs:5:1)
11 changes: 11 additions & 0 deletions vim/test/assets/suggested-fix-multiline.hs.ghc-9.4.8.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[1 of 2] Compiling Main ( suggested-fix-multiline.hs, suggested-fix-multiline.o )

suggested-fix-multiline.hs:1:1: error:
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘foo_’ (Defined at suggested-fix-multiline.hs:2:1)

suggested-fix-multiline.hs:4:1: error:
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘bar_’ (Defined at suggested-fix-multiline.hs:5:1)
11 changes: 11 additions & 0 deletions vim/test/assets/suggested-fix-multiline.hs.ghc-9.6.6.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[1 of 2] Compiling Main ( suggested-fix-multiline.hs, suggested-fix-multiline.o )

suggested-fix-multiline.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘foo_’ (Defined at suggested-fix-multiline.hs:2:1)

suggested-fix-multiline.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘bar_’ (Defined at suggested-fix-multiline.hs:5:1)
11 changes: 11 additions & 0 deletions vim/test/assets/suggested-fix-multiline.hs.ghc-9.8.2.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[1 of 2] Compiling Main ( suggested-fix-multiline.hs, suggested-fix-multiline.o )

suggested-fix-multiline.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘foo_’ (Defined at suggested-fix-multiline.hs:2:1)

suggested-fix-multiline.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix:
Perhaps use ‘bar_’ (Defined at suggested-fix-multiline.hs:5:1)
5 changes: 5 additions & 0 deletions vim/test/assets/suggested-fix.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
foo :: Int
foo_ = 23

bar :: Int
bar_ = 23
9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix.hs.ghc-9.10.1.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 2] Compiling Main ( suggested-fix.hs, suggested-fix.o )
suggested-fix.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix: Perhaps use ‘foo_’ (Defined at suggested-fix.hs:2:1)

suggested-fix.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix: Perhaps use ‘bar_’ (Defined at suggested-fix.hs:5:1)

9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix.hs.ghc-9.2.8.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 1] Compiling Main ( suggested-fix.hs, suggested-fix.o )

suggested-fix.hs:1:1: error:
The type signature for ‘foo’ lacks an accompanying binding
Perhaps you meant ‘foo_’ (Defined at suggested-fix.hs:2:1)

suggested-fix.hs:4:1: error:
The type signature for ‘bar’ lacks an accompanying binding
Perhaps you meant ‘bar_’ (Defined at suggested-fix.hs:5:1)
9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix.hs.ghc-9.4.8.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 2] Compiling Main ( suggested-fix.hs, suggested-fix.o )

suggested-fix.hs:1:1: error:
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix: Perhaps use ‘foo_’ (Defined at suggested-fix.hs:2:1)

suggested-fix.hs:4:1: error:
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix: Perhaps use ‘bar_’ (Defined at suggested-fix.hs:5:1)
9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix.hs.ghc-9.6.6.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 2] Compiling Main ( suggested-fix.hs, suggested-fix.o )

suggested-fix.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix: Perhaps use ‘foo_’ (Defined at suggested-fix.hs:2:1)

suggested-fix.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix: Perhaps use ‘bar_’ (Defined at suggested-fix.hs:5:1)
9 changes: 9 additions & 0 deletions vim/test/assets/suggested-fix.hs.ghc-9.8.2.errors
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[1 of 2] Compiling Main ( suggested-fix.hs, suggested-fix.o )

suggested-fix.hs:1:1: error: [GHC-44432]
The type signature for ‘foo’ lacks an accompanying binding
Suggested fix: Perhaps use ‘foo_’ (Defined at suggested-fix.hs:2:1)

suggested-fix.hs:4:1: error: [GHC-44432]
The type signature for ‘bar’ lacks an accompanying binding
Suggested fix: Perhaps use ‘bar_’ (Defined at suggested-fix.hs:5:1)
4 changes: 2 additions & 2 deletions vim/test/assets/type-error.hs.ghc-9.10.1.errors
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o )
vim/test/assets/type-error.hs:2:7: error: [GHC-83865]
[1 of 2] Compiling Main ( type-error.hs, type-error.o )
type-error.hs:2:7: error: [GHC-83865]
Couldn't match type ‘Int’ with ‘[Char]’
Expected: String
Actual: Int
Expand Down
4 changes: 2 additions & 2 deletions vim/test/assets/type-error.hs.ghc-9.2.8.errors
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1 of 1] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o )
[1 of 1] Compiling Main ( type-error.hs, type-error.o )

vim/test/assets/type-error.hs:2:7: error:
type-error.hs:2:7: error:
• Couldn't match type ‘Int’ with ‘[Char]’
Expected: String
Actual: Int
Expand Down
4 changes: 2 additions & 2 deletions vim/test/assets/type-error.hs.ghc-9.4.8.errors
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o )
[1 of 2] Compiling Main ( type-error.hs, type-error.o )

vim/test/assets/type-error.hs:2:7: error:
type-error.hs:2:7: error:
• Couldn't match type ‘Int’ with ‘[Char]’
Expected: String
Actual: Int
Expand Down
4 changes: 2 additions & 2 deletions vim/test/assets/type-error.hs.ghc-9.6.6.errors
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o )
[1 of 2] Compiling Main ( type-error.hs, type-error.o )

vim/test/assets/type-error.hs:2:7: error: [GHC-83865]
type-error.hs:2:7: error: [GHC-83865]
Couldn't match type ‘Int’ with ‘[Char]’
Expected: String
Actual: Int
4 changes: 2 additions & 2 deletions vim/test/assets/type-error.hs.ghc-9.8.2.errors
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o )
[1 of 2] Compiling Main ( type-error.hs, type-error.o )

vim/test/assets/type-error.hs:2:7: error: [GHC-83865]
type-error.hs:2:7: error: [GHC-83865]
Couldn't match type ‘Int’ with ‘[Char]’
Expected: String
Actual: Int
11 changes: 0 additions & 11 deletions vim/test/assets/type-signature-lacks-binding.hs.ghc-9.10.1.errors

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions vim/test/assets/type-signature-lacks-binding.hs.ghc-9.4.8.errors

This file was deleted.

11 changes: 0 additions & 11 deletions vim/test/assets/type-signature-lacks-binding.hs.ghc-9.6.6.errors

This file was deleted.

11 changes: 0 additions & 11 deletions vim/test/assets/type-signature-lacks-binding.hs.ghc-9.8.2.errors

This file was deleted.

File renamed without changes.

0 comments on commit 04cef0c

Please sign in to comment.