lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
691 stars 67 forks source link

Support GHC 8.10 #324

Closed tfausak closed 3 years ago

tfausak commented 4 years ago

Continuing work from #312.

tfausak commented 4 years ago

Now there is a legitimate test failure against GHC 8.10. It's related to #48. I don't know enough to fix it.

  src-literatetests/Main.hs:183:3: 
  1) regression issue 48 a
       expected: Right 
                 foo =
                   let a    = b@1
                       cccc = ()
                   in  foo

        but got: Right 
                 foo =
                   let a    = _
                       cccc = ()
                   in  foo

  To rerun use: --match "/regression/issue 48 a/"

  src-literatetests/Main.hs:183:3: 
  2) context free: regression issue 48 a
       expected: Right 
                 foo =
                   let
                     a = b@1
                     cccc = ()
                   in foo

        but got: Right 
                 foo =
                   let
                     a = _
                     cccc = ()
                   in foo

https://github.com/lspitzner/brittany/pull/324/checks?check_run_id=1403080234#step:7:1202

expipiplus1 commented 4 years ago

Now there is a legitimate test failure against GHC 8.10. It's related to #48. I don't know enough to fix it.

Looking at --dump-full-ast from brittany with 8.8 and brittany with 8.10, we can see a difference:

where 8.8 returns:

[ A Just (Ann (DP (0,-1)) [] [] [] Nothing Nothing)
    GRHS
      NoExt
      []
      A Just (Ann (DP (0,1)) [] [] [((G AnnAt),DP (0,0))] Nothing Nothing)
        EAsPat
          NoExt
          A Just (Ann (DP (0,0)) [] [] [((G AnnVal),DP (0,0))] Nothing Nothing)
            Unqual {OccName: b}
          A Just (Ann (DP (0,0)) [] [] [((G AnnVal),DP (0,0))] Nothing Nothing)
            HsOverLit
              NoExt
              OverLit
                NoExt
                HsIntegral
                  IL
                    SourceText "1"
                    False
                    1
                HsLit
                  NoExt
                  HsString
                    SourceText "noExpr"
                    {FastString: "noExpr"}
]

8.10 returns a hole!

[ A Just (Ann (DP (0,-1)) [] [] [] Nothing Nothing)
    GRHS
      NoExtField
      []
      A Just (Ann (DP (0,1)) [] [] [((G AnnVal),DP (0,0))] Nothing Nothing)
        HsUnboundVar
          NoExtField
          TrueExprHole {OccName: _}
]

It's also not valid syntax as ghci tells us:

λ> b = a@()

<interactive>:3:5: error:
    Pattern syntax in expression context: a@()
    Type application syntax requires a space before '@'

I think it's fine to remove this test (or correct it so that it has the space before the @)

expipiplus1 commented 4 years ago

It's surprising to me that the AST can even represent this, although perhaps it's useful for error messages or something

tfausak commented 4 years ago

or correct it so that it has the space before the @

👍

expipiplus1 commented 4 years ago

Need to update the supported GHC versions in the readme

tfausak commented 4 years ago

I should make sure there are stack.yaml files for each configuration. Then I think this will be ready to go.

expipiplus1 commented 3 years ago

@tfausak would you like any help with this release?

tfausak commented 3 years ago

Sorry! Thanks for the ping. I don't need any help with this, I just have to actually do it. With any luck I should be able to spend some time on it in the next few days.