Silent failure when using -XBangPatterns #321

Open
opened 2020-11-09 16:09:19 +01:00 by emlautarom1 · 0 comments
emlautarom1 commented 2020-11-09 16:09:19 +01:00 (Migrated from github.com)

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
There are some cases where formatting silently fails when `-XBangPatterns` is enabled. Some examples: ```haskell {-# 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](https://github.com/haskell/haskell-language-server) 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 ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#321
There is no content yet.