haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

Hlint parse error with RecordWildCards language extension #1651

Open fimmind opened 4 years ago

fimmind commented 4 years ago

Minimal example (app/Main.hs file in standard stack's new template):

{-# LANGUAGE RecordWildCards #-}

data Foo a = Foo {foo :: a, bar :: a}

fun :: Foo a -> a
fun f @ Foo{..} = foo

main :: IO ()
main = pure ()

And it throws such error:

[hlint parser] [I] /tmp/haskell-lsp5450/Main.hs-00023--8855030527756882730.hs:6:12: error:
    parse error on input `{'
  fun :: Foo a -> a
> fun f @ Foo{..} = foo

  main :: IO ()

Screenshot (I'm using NeoVim with coc.nvim): 10 02 20_16:50:03:067995852

Coc.nvim settings copied from README.

HIE version:

$ hie --version
Version 1.1, Git revision 49c6185efdec715a4b2954efa7887520f7196cc8 (3775 commits) x86_64 ghc-8.6.5
ndmitchell commented 4 years ago

I believe this is an underlying bug in haskell-src-exts, and an underlying bug in HLInt. If you change it to:

fun f@Foo{..} = foo

The bug should go away. Furthermore, work is being done to eliminate haskell-src-exts, which will solve this problem for good.