branch: elpa/haskell-tng-mode commit fc4d3e3f4b65e0500406af68b60c7f7cf3e5fcf5 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
compilation mode supports multiline error spans --- README.md | 1 + haskell-tng-compile.el | 8 +++--- test/{src => compile}/ghc-8.4.4-error.compile | 0 .../ghc-8.4.4-error.compile.faceup | 0 test/{src => compile}/ghc-8.4.4-errorspan.compile | 18 ++++++++++--- test/compile/ghc-8.4.4-errorspan.compile.faceup | 31 ++++++++++++++++++++++ test/{src => compile}/ghc-8.4.4-warning.compile | 0 .../ghc-8.4.4-warning.compile.faceup | 0 .../{src => compile}/ghc-8.4.4-warningspan.compile | 14 +++++++--- .../ghc-8.4.4-warningspan.compile.faceup | 14 +++++++--- test/{src => compile}/hspec-failure.compile | 0 test/{src => compile}/hspec-failure.compile.faceup | 0 test/{src => compile}/tasty-failure.compile | 0 test/{src => compile}/tasty-failure.compile.faceup | 0 test/haskell-tng-compile-test.el | 14 +++++----- test/src/ghc-8.4.4-errorspan.compile.faceup | 21 --------------- 16 files changed, 78 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 2ecc458..022c338 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Some blue sky features are being considered but may be best as independent proje - Code gen - two spaces after an `import` converts to the missing `qualified` (or is this indentation?) - `instance` boilerplate +- Cleanup unused imports - Refactoring - be compatible with [`apply-refact`](https://github.com/mpickering/apply-refact) / [`hlint-refactor-mode`](https://github.com/mpickering/hlint-refactor-mode) - convert wildcard import to explicit list diff --git a/haskell-tng-compile.el b/haskell-tng-compile.el index 26afe98..39b23f9 100644 --- a/haskell-tng-compile.el +++ b/haskell-tng-compile.el @@ -25,7 +25,10 @@ 1 2 (3 . 4) 2 1) (,(rx-to-string `(: bol ,file ":" ,num ":" ,num (? "-" ,num) ": warning:")) 1 2 (3 . 4) 1 1) - ;; FIXME multi-line error spans (and tests) + (,(rx-to-string `(: bol ,file ":(" ,num "," ,num ")-(" ,num "," ,num ")" ": error:")) + 1 (2 . 4) (3 . 5) 2 1) + (,(rx-to-string `(: bol ,file ":(" ,num "," ,num ")-(" ,num "," ,num ")" ": warning:")) + 1 (2 . 4) (3 . 5) 1 1) ;; hspec (,(rx-to-string `(: bol (+ space) ,file ":" ,num ":" ,num ":")) @@ -35,8 +38,7 @@ `(: bol (+ space) "error, called at" (+ space) ,file ":" ,num ":" ,num " in ")) 1 2 3 2 1) )) - "The `compilation-error-regexp-alist' for `haskell-tng'." - ) + "The `compilation-error-regexp-alist' for `haskell-tng'.") (defvar haskell-tng-compile:history '("cabal v2-build -O0")) (defvar-local haskell-tng-compile:command nil) diff --git a/test/src/ghc-8.4.4-error.compile b/test/compile/ghc-8.4.4-error.compile similarity index 100% rename from test/src/ghc-8.4.4-error.compile rename to test/compile/ghc-8.4.4-error.compile diff --git a/test/src/ghc-8.4.4-error.compile.faceup b/test/compile/ghc-8.4.4-error.compile.faceup similarity index 100% rename from test/src/ghc-8.4.4-error.compile.faceup rename to test/compile/ghc-8.4.4-error.compile.faceup diff --git a/test/src/ghc-8.4.4-errorspan.compile b/test/compile/ghc-8.4.4-errorspan.compile similarity index 50% rename from test/src/ghc-8.4.4-errorspan.compile rename to test/compile/ghc-8.4.4-errorspan.compile index ce001bb..bcf21e3 100644 --- a/test/src/ghc-8.4.4-errorspan.compile +++ b/test/compile/ghc-8.4.4-errorspan.compile @@ -10,11 +10,21 @@ Building library for stackage-to-hackage-1.1.0.. [1 of 2] Compiling StackageToHackage.Stackage [2 of 2] Compiling StackageToHackage.Hackage -lib/StackageToHackage/Hackage.hs:35:16-18: error: - parse error on input ‘...’ +lib/StackageToHackage/Hackage.hs:13:1-53: error: + Could not find module ‘Data.ByteStrong’ + Perhaps you meant Data.ByteString (from bytestring-0.10.8.2) + Use -v to see a list of the files searched for. | -35 | freeze = ... - | ^^^ +13 | import qualified Data.ByteStrong as BS + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +lib/StackageToHackage/Hackage.hs:(19,1)-(20,56): error: + Could not find module ‘Data.Moybe’ + Perhaps you meant Data.Maybe (from base-4.11.1.0) + Use -v to see a list of the files searched for. + | +19 | import Data.Moybe (fromMaybe, mapMaybe, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... cabal: Failed to build stackage-to-hackage-1.1.0 (which is required by exe:stackage-to-hackage from stackage-to-hackage-1.1.0 and exe:stack2cabal from stack2cabal-1.0.2). diff --git a/test/compile/ghc-8.4.4-errorspan.compile.faceup b/test/compile/ghc-8.4.4-errorspan.compile.faceup new file mode 100644 index 0000000..57c8640 --- /dev/null +++ b/test/compile/ghc-8.4.4-errorspan.compile.faceup @@ -0,0 +1,31 @@ +Resolving dependencies... +Build profile: -w ghc-8.4.4 -O0 +In order, the following will be built (use -v for more details): + - stackage-to-hackage-1.1.0 (lib) (first run) + - stackage-to-hackage-1.1.0 (exe:stackage-to-hackage) (first run) + - stack2cabal-1.0.2 (exe:stack2cabal) (first run) +Configuring library for stackage-to-hackage-1.1.0.. +Preprocessing library for stackage-to-hackage-1.1.0.. +Building library for stackage-to-hackage-1.1.0.. +[1 of 2] Compiling StackageToHackage.Stackage +[2 of 2] Compiling StackageToHackage.Hackage + +«U:«:compilation-error:lib/StackageToHackage/Hackage.hs»»:«:compilation-line-number:13»:«:compilation-column-number:1»-«:compilation-column-number:53»: error: + Could not find module ‘Data.ByteStrong’ + Perhaps you meant Data.ByteString (from bytestring-0.10.8.2) + Use -v to see a list of the files searched for. + | +13 | import qualified Data.ByteStrong as BS + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +«U:«:compilation-error:lib/StackageToHackage/Hackage.hs»»:(«:compilation-line-number:19»,«:compilation-column-number:1»)-(«:compilation-line-number:20»,«:compilation-column-number:56»): error: + Could not find module ‘Data.Moybe’ + Perhaps you meant Data.Maybe (from base-4.11.1.0) + Use -v to see a list of the files searched for. + | +19 | import Data.Moybe (fromMaybe, mapMaybe, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... +cabal: Failed to build stackage-to-hackage-1.1.0 (which is required by +exe:stackage-to-hackage from stackage-to-hackage-1.1.0 and exe:stack2cabal +from stack2cabal-1.0.2). + diff --git a/test/src/ghc-8.4.4-warning.compile b/test/compile/ghc-8.4.4-warning.compile similarity index 100% rename from test/src/ghc-8.4.4-warning.compile rename to test/compile/ghc-8.4.4-warning.compile diff --git a/test/src/ghc-8.4.4-warning.compile.faceup b/test/compile/ghc-8.4.4-warning.compile.faceup similarity index 100% rename from test/src/ghc-8.4.4-warning.compile.faceup rename to test/compile/ghc-8.4.4-warning.compile.faceup diff --git a/test/src/ghc-8.4.4-warningspan.compile b/test/compile/ghc-8.4.4-warningspan.compile similarity index 75% rename from test/src/ghc-8.4.4-warningspan.compile rename to test/compile/ghc-8.4.4-warningspan.compile index 8cfa92a..f6ab039 100644 --- a/test/src/ghc-8.4.4-warningspan.compile +++ b/test/compile/ghc-8.4.4-warningspan.compile @@ -10,15 +10,21 @@ Building library for stackage-to-hackage-1.1.0.. [1 of 2] Compiling StackageToHackage.Stackage [2 of 2] Compiling StackageToHackage.Hackage -lib/StackageToHackage/Hackage.hs:13:1-51: warning: [-Wunused-imports] +lib/StackageToHackage/Hackage.hs:13:1-53: warning: [-Wunused-imports] The qualified import of ‘Data.ByteString’ is redundant except perhaps to import instances from ‘Data.ByteString’ To import instances alone, use: import Data.ByteString() | -13 | import qualified Data.ByteString as BS - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Configuring executable 'stack2cabal' for stack2cabal-1.0.2.. +13 | import qualified Data.ByteString as BS + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +lib/StackageToHackage/Hackage.hs:(19,1)-(20,56): warning: [-Wunused-imports] + The import of ‘isJust’ from module ‘Data.Maybe’ is redundant + | +19 | import Data.Maybe (fromMaybe, mapMaybe, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... Configuring executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. +Configuring executable 'stack2cabal' for stack2cabal-1.0.2.. Preprocessing executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. Building executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. Preprocessing executable 'stack2cabal' for stack2cabal-1.0.2.. diff --git a/test/src/ghc-8.4.4-warningspan.compile.faceup b/test/compile/ghc-8.4.4-warningspan.compile.faceup similarity index 72% rename from test/src/ghc-8.4.4-warningspan.compile.faceup rename to test/compile/ghc-8.4.4-warningspan.compile.faceup index 3be8863..25cc994 100644 --- a/test/src/ghc-8.4.4-warningspan.compile.faceup +++ b/test/compile/ghc-8.4.4-warningspan.compile.faceup @@ -10,15 +10,21 @@ Building library for stackage-to-hackage-1.1.0.. [1 of 2] Compiling StackageToHackage.Stackage [2 of 2] Compiling StackageToHackage.Hackage -«U:«:compilation-warning:lib/StackageToHackage/Hackage.hs»»:«:compilation-line-number:13»:«:compilation-column-number:1»-«:compilation-column-number:51»: warning: [-Wunused-imports] +«U:«:compilation-warning:lib/StackageToHackage/Hackage.hs»»:«:compilation-line-number:13»:«:compilation-column-number:1»-«:compilation-column-number:53»: warning: [-Wunused-imports] The qualified import of ‘Data.ByteString’ is redundant except perhaps to import instances from ‘Data.ByteString’ To import instances alone, use: import Data.ByteString() | -13 | import qualified Data.ByteString as BS - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Configuring executable 'stack2cabal' for stack2cabal-1.0.2.. +13 | import qualified Data.ByteString as BS + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +«U:«:compilation-warning:lib/StackageToHackage/Hackage.hs»»:(«:compilation-line-number:19»,«:compilation-column-number:1»)-(«:compilation-line-number:20»,«:compilation-column-number:56»): warning: [-Wunused-imports] + The import of ‘isJust’ from module ‘Data.Maybe’ is redundant + | +19 | import Data.Maybe (fromMaybe, mapMaybe, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... Configuring executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. +Configuring executable 'stack2cabal' for stack2cabal-1.0.2.. Preprocessing executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. Building executable 'stackage-to-hackage' for stackage-to-hackage-1.1.0.. Preprocessing executable 'stack2cabal' for stack2cabal-1.0.2.. diff --git a/test/src/hspec-failure.compile b/test/compile/hspec-failure.compile similarity index 100% rename from test/src/hspec-failure.compile rename to test/compile/hspec-failure.compile diff --git a/test/src/hspec-failure.compile.faceup b/test/compile/hspec-failure.compile.faceup similarity index 100% rename from test/src/hspec-failure.compile.faceup rename to test/compile/hspec-failure.compile.faceup diff --git a/test/src/tasty-failure.compile b/test/compile/tasty-failure.compile similarity index 100% rename from test/src/tasty-failure.compile rename to test/compile/tasty-failure.compile diff --git a/test/src/tasty-failure.compile.faceup b/test/compile/tasty-failure.compile.faceup similarity index 100% rename from test/src/tasty-failure.compile.faceup rename to test/compile/tasty-failure.compile.faceup diff --git a/test/haskell-tng-compile-test.el b/test/haskell-tng-compile-test.el index 062c363..6f5d4c6 100644 --- a/test/haskell-tng-compile-test.el +++ b/test/haskell-tng-compile-test.el @@ -46,17 +46,17 @@ ;;(kill-line -2) )) -;; to generate .faceup files, use faceup-view-buffer +;; cabal v2-clean && cabal v2-build -O0 all > ghc-8.4.4-error.compile 2>&1 (ert-deftest haskell-tng-compile-errors-file-tests () - (should (have-expected-errors (testdata "src/ghc-8.4.4-error.compile"))) - (should (have-expected-errors (testdata "src/ghc-8.4.4-errorspan.compile")))) + (should (have-expected-errors (testdata "compile/ghc-8.4.4-error.compile"))) + (should (have-expected-errors (testdata "compile/ghc-8.4.4-errorspan.compile")))) (ert-deftest haskell-tng-compile-warnings-file-tests () - (should (have-expected-errors (testdata "src/ghc-8.4.4-warning.compile"))) - (should (have-expected-errors (testdata "src/ghc-8.4.4-warningspan.compile")))) + (should (have-expected-errors (testdata "compile/ghc-8.4.4-warning.compile"))) + (should (have-expected-errors (testdata "compile/ghc-8.4.4-warningspan.compile")))) (ert-deftest haskell-tng-compile-hspec-file-tests () - (should (have-expected-errors (testdata "src/hspec-failure.compile")))) + (should (have-expected-errors (testdata "compile/hspec-failure.compile")))) (ert-deftest haskell-tng-compile-tasty-file-tests () ;; TODO assert on ansi colours, implemented with overlays @@ -68,7 +68,7 @@ ;; modification-hooks (ansi-color-freeze-overlay) ;; There are text properties here: ;; fontified t - (should (have-expected-errors (testdata "src/tasty-failure.compile")))) + (should (have-expected-errors (testdata "compile/tasty-failure.compile")))) ;; TODO test invoking haskell-tng-compile in a real project directory diff --git a/test/src/ghc-8.4.4-errorspan.compile.faceup b/test/src/ghc-8.4.4-errorspan.compile.faceup deleted file mode 100644 index a399f37..0000000 --- a/test/src/ghc-8.4.4-errorspan.compile.faceup +++ /dev/null @@ -1,21 +0,0 @@ -Resolving dependencies... -Build profile: -w ghc-8.4.4 -O0 -In order, the following will be built (use -v for more details): - - stackage-to-hackage-1.1.0 (lib) (first run) - - stackage-to-hackage-1.1.0 (exe:stackage-to-hackage) (first run) - - stack2cabal-1.0.2 (exe:stack2cabal) (first run) -Configuring library for stackage-to-hackage-1.1.0.. -Preprocessing library for stackage-to-hackage-1.1.0.. -Building library for stackage-to-hackage-1.1.0.. -[1 of 2] Compiling StackageToHackage.Stackage -[2 of 2] Compiling StackageToHackage.Hackage - -«U:«:compilation-error:lib/StackageToHackage/Hackage.hs»»:«:compilation-line-number:35»:«:compilation-column-number:16»-«:compilation-column-number:18»: error: - parse error on input ‘...’ - | -35 | freeze = ... - | ^^^ -cabal: Failed to build stackage-to-hackage-1.1.0 (which is required by -exe:stackage-to-hackage from stackage-to-hackage-1.1.0 and exe:stack2cabal -from stack2cabal-1.0.2). -