Skip to content

Support GHC 9.0.1 #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
ghc: ["8.10.3", "8.8.4", "8.6.5"]
ghc: ["9.0.1", "8.10.4", "8.8.4", "8.6.5"]
env:
CONFIG: "--enable-tests --enable-benchmarks"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-haskell@v1.1.4
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "3.2"
cabal-version: "3.4"
- run: cabal v2-update
- run: cabal v2-freeze $CONFIG
- uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: rwe/actions-hlint-setup@v1
with:
version: '3.1.6'
version: '3.2.7'
- uses: rwe/actions-hlint-run@v2
with:
path: '["src/"]'
Expand Down
87 changes: 63 additions & 24 deletions apply-refact.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extra-source-files: CHANGELOG
, tests/examples/*.hs
, tests/examples/*.hs.refact
, tests/examples/*.hs.expected
tested-with: GHC == 8.10.3, GHC == 8.8.4, GHC == 8.6.5
tested-with: GHC == 9.0.1, GHC == 8.10.3, GHC == 8.8.4, GHC == 8.6.5


source-repository head
Expand All @@ -33,7 +33,7 @@ library
GHC-Options: -Wall
build-depends: base >=4.12 && < 5
, refact >= 0.2
, ghc-exactprint >= 0.6.3.3
, ghc-exactprint >= 0.6.4
, ghc >= 8.6
, ghc-boot-th
, containers >= 0.6.0.1 && < 0.7
Expand All @@ -46,6 +46,19 @@ library
, unix-compat >= 0.5.2
, directory >= 1.3
, uniplate >= 1.6.13
default-extensions: FlexibleContexts
, FlexibleInstances
, FunctionalDependencies
, GADTs
, LambdaCase
, MultiParamTypeClasses
, NamedFieldPuns
, PolyKinds
, RankNTypes
, ScopedTypeVariables
, TupleSections
, TypeApplications
, TypeOperators
hs-source-dirs: src
default-language: Haskell2010

Expand Down Expand Up @@ -80,6 +93,19 @@ executable refactor
, filepath
, transformers
, uniplate
default-extensions: FlexibleContexts
, FlexibleInstances
, FunctionalDependencies
, GADTs
, LambdaCase
, MultiParamTypeClasses
, NamedFieldPuns
, PolyKinds
, RankNTypes
, ScopedTypeVariables
, TupleSections
, TypeApplications
, TypeOperators

Test-Suite test
type: exitcode-stdio-1.0
Expand All @@ -93,25 +119,38 @@ Test-Suite test
Refact.Options
Refact.Run
Refact.Utils
GHC-Options: -threaded
Default-language: Haskell2010
Build-depends: tasty
, tasty-golden
, tasty-expected-failure
, base
, refact
, ghc-exactprint
, ghc
, ghc-boot-th
, containers
, extra
, syb
, process
, directory
, optparse-applicative
, filemanip
, unix-compat
, filepath
, silently
, transformers
, uniplate
ghc-options: -threaded
default-language: Haskell2010
build-depends: tasty
, tasty-golden
, tasty-expected-failure
, base
, refact
, ghc-exactprint
, ghc
, ghc-boot-th
, containers
, extra
, syb
, process
, directory
, optparse-applicative
, filemanip
, unix-compat
, filepath
, silently
, transformers
, uniplate
default-extensions: FlexibleContexts
, FlexibleInstances
, FunctionalDependencies
, GADTs
, LambdaCase
, MultiParamTypeClasses
, NamedFieldPuns
, PolyKinds
, RankNTypes
, ScopedTypeVariables
, TupleSections
, TypeApplications
, TypeOperators
2 changes: 0 additions & 2 deletions src/Refact/Apply.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE TupleSections #-}

module Refact.Apply
( applyRefactorings
, applyRefactorings'
Expand Down
19 changes: 13 additions & 6 deletions src/Refact/Fixity.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
module Refact.Fixity (applyFixities) where

import SrcLoc
module Refact.Fixity (applyFixities) where

import Refact.Utils
import BasicTypes (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..), SourceText(..))

#if __GLASGOW_HASKELL__ >= 810
import GHC.Hs
Expand All @@ -15,9 +12,20 @@ import HsExpr
import HsExtension hiding (noExt)
#endif

#if __GLASGOW_HASKELL__ >= 900
import GHC.Parser.Annotation
import GHC.Types.Basic (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..), SourceText(..))
import GHC.Types.Name.Occurrence
import GHC.Types.Name.Reader
import GHC.Types.SrcLoc
#else
import ApiAnnotation
import BasicTypes (Fixity(..), defaultFixity, compareFixity, negateFixity, FixityDirection(..), SourceText(..))
import RdrName
import OccName
import SrcLoc
#endif

import Data.Generics hiding (Fixity)
import Data.List
import Data.Maybe
Expand Down Expand Up @@ -105,13 +113,12 @@ mkOpAppRn fs loc e1@(L _ (NegApp _ neg_arg neg_name)) op2 fix2 e2
moveDelta oldAnn oldKey newKey
let res = L loc (NegApp noExt new_e neg_name)
key = mkAnnKey res
ak = AnnKey loc (CN "OpApp")
ak = AnnKey (srcSpanToAnnSpan loc) (CN "OpApp")
opAnn <- gets (fromMaybe annNone . Map.lookup ak)
negAnns <- gets (fromMaybe annNone . Map.lookup (mkAnnKey e1))
modify $ Map.insert key (annNone { annEntryDelta = annEntryDelta opAnn, annsDP = annsDP negAnns })
modify $ Map.delete (mkAnnKey e1)
return res

where
loc' = combineLocs neg_arg e2
(nofix_error, associate_right) = compareFixity negateFixity fix2
Expand Down
Loading