brittany icon indicating copy to clipboard operation
brittany copied to clipboard

Silent failure when using -XBangPatterns

Open emlautarom1 opened this issue 4 years ago • 0 comments

There are some cases where formatting silently fails when -XBangPatterns is enabled.

Some examples:

{-# LANGUAGE BangPatterns #-}

-- These work
data Example = Example {-# UNPACK #-} !Int

data Example1 
  = Example1 {-# UNPACK #-} !Int

-- These fail
data ExampleFail 
  = ExampleFail 
    {-# UNPACK #-} !Int

data ExampleFail2
  = ExampleFail2
  {-# UNPACK #-} !Int

The CLI does not complain, but when using hls on Visual Studio Code you can see in the output tab the following message from hls:

[Error - 12:07:48 PM] Request textDocument/formatting failed.
  Message: brittanyCmd: HsBangTy{}
HsBangTy{}
HsBangTy{}
HsBangTy{}
HsBangTy{}
HsBangTy{}
HsBangTy{}
HsBangTy{}

  Code: -32602

emlautarom1 avatar Nov 09 '20 15:11 emlautarom1