Skip to content

Commit

Permalink
Workaround GHC #11214 by filtering JavaScriptFFI
Browse files Browse the repository at this point in the history
Unfortunately, "native" GHC advertises support for `JavaScriptFFI` even though
it doesn't support it. See also https://ghc.haskell.org/ticket/11214 for respective
bug.

However, in order to properly declare that packages require `JavaScriptFFI` support
via `other-extensions` we need to fixup the list of extensions fed to the cabal solver.

This patch does something similiar to the workaround we added some time ago to
filter out TemplateHaskell for older GHCs which didn't properly advertise
`TemplateHaskell` availability (c.f. 9f68eb4)

(cherry picked from commit 608517b)
  • Loading branch information
hvr authored and 23Skidoo committed Oct 18, 2016
1 parent 7ba7489 commit 0bae317
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Cabal/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,21 @@ configure verbosity hcPath hcPkgPath conf0 = do

ghcInfo <- Internal.getGhcInfo verbosity implInfo ghcProg
let ghcInfoMap = M.fromList ghcInfo
extensions = -- workaround https://ghc.haskell.org/ticket/11214
filterExt JavaScriptFFI $
-- see 'filterExtTH' comment below
filterExtTH $ extensions0

-- starting with GHC 8.0, `TemplateHaskell` will be omitted from
-- `--supported-extensions` when it's not available.
-- for older GHCs we can use the "Have interpreter" property to
-- filter out `TemplateHaskell`
extensions | ghcVersion < Version [8] []
, Just "NO" <- M.lookup "Have interpreter" ghcInfoMap
= filter ((/= EnableExtension TemplateHaskell) . fst)
extensions0
| otherwise = extensions0
filterExtTH | ghcVersion < Version [8] []
, Just "NO" <- M.lookup "Have interpreter" ghcInfoMap
= filterExt TemplateHaskell
| otherwise = id

filterExt ext = filter ((/= EnableExtension ext) . fst)

let comp = Compiler {
compilerId = CompilerId GHC ghcVersion,
Expand Down

0 comments on commit 0bae317

Please sign in to comment.