mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-28 23:06:51 +08:00
Handle ghc panic in haskell (#4145)
* Add primitive handling of ghc panic. * PascalCase in function. * Add simple test.
This commit is contained in:
@@ -130,3 +130,48 @@ Execute(The ghc handler should handle stack 1.5.1 output):
|
||||
\ ' 160 | pattern F :: Exp a',
|
||||
\ ' | ^^^^^',
|
||||
\ ])
|
||||
|
||||
Execute(The ghc handler should handle ghc panic):
|
||||
let g:detail = [
|
||||
\ '[15 of 15] Compiling SizedTypes.List',
|
||||
\ 'ghc: panic! (the ''impossible'' happened)',
|
||||
\ ' (GHC version 8.10.3:',
|
||||
\ ' src/SizedTypes/List.hs:(46,19)-(50,0) Specified type does not refine Haskell type for `SizedTypes.List.out` (Plugged Init types new)',
|
||||
\ ' The Liquid type',
|
||||
\ ' .',
|
||||
\ ' GHC.Types.Int -> (SizedTypes.List.List a) -> (_, (SizedTypes.List.List a))',
|
||||
\ ' .',
|
||||
\ ' is inconsistent with the Haskell type',
|
||||
\ ' .',
|
||||
\ ' forall p a ->',
|
||||
\ 'p -> SizedTypes.List.List a -> (a, SizedTypes.List.List a)',
|
||||
\ ' .',
|
||||
\ ' defined at src/SizedTypes/List.hs:52:1-3',
|
||||
\ ' .',
|
||||
\ ' Specifically, the Liquid component',
|
||||
\ ' .',
|
||||
\ ' {VV##0 : GHC.Types.Int | VV##0 >= 0}',
|
||||
\ ' .',
|
||||
\ ' is inconsistent with the Haskell component',
|
||||
\ ' .',
|
||||
\ ' p',
|
||||
\ ' .',
|
||||
\ ' ',
|
||||
\ ' HINT: Use the hole ''_'' instead of the mismatched component (in the Liquid specification)',
|
||||
\ '',
|
||||
\ 'Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug',
|
||||
\ '',
|
||||
\ ''
|
||||
\ ]
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'ghc panic!',
|
||||
\ 'detail': join(g:detail[1:-3], "\n"),
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#haskell#HandleGHCFormat(bufnr(''), g:detail)
|
||||
unlet g:detail
|
||||
|
||||
Reference in New Issue
Block a user