Skip to content
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

Support GHC 9.2 #305

Closed
1 of 3 tasks
Tracked by #15
andreasabel opened this issue Oct 18, 2021 · 2 comments · Fixed by #306
Closed
1 of 3 tasks
Tracked by #15

Support GHC 9.2 #305

andreasabel opened this issue Oct 18, 2021 · 2 comments · Fixed by #306
Assignees

Comments

@andreasabel
Copy link
Collaborator

andreasabel commented Oct 18, 2021

Migration code might be at: https://gitlab.haskell.org/ghc/head.hackage/-/blob/master/patches/doctest-0.18.1.patch by @RyanGlScott (btw, it would be great if you opened a PR with the migrating patch...)

UPDATE: Blocked by

Blocking:

@LeventErkok
Copy link
Contributor

@andreasabel @RyanGlScott

Now that 9.2.1 is officially out, it'd be really nice to have this release. Here's what I'm seeing when trying to compile with 9.2.1:

[ 1 of 15] Compiling GhcUtil

src/GhcUtil.hs:100:7: error: Not in scope: ‘hscTarget’
    |
100 |       hscTarget = HscNothing
    |       ^^^^^^^^^

@RyanGlScott
Copy link
Contributor

Just to clarify, I'm not a doctest maintainer. I often find myself writing patches for head.hackage, but there's no guarantee that the code in a head.hackage patch will correspond to the code you'd actually want to put in a new release. Among other reasons:

  • head.hackage only needs to support the latest GHC release, so sometimes head.hackage patches won't compile on all GHC versions.
  • I'm far from an expert on the libraries that I'm patching (doctest included), so some of the patches I write may deviate from the code style that a library's maintainers would prefer.

@andreasabel andreasabel self-assigned this Oct 31, 2021
andreasabel added a commit to andreasabel/doctest that referenced this issue Oct 31, 2021
With this commit, based on Ryan Scott's patch, building with
```
cabal v1-install --enable-tests --allow-newer=hsc2hs:base --allow-newer=ghc-paths:Cabal
cabal v1-test
```
the tests pass except for the `TemplateHaskell` ones (see below).
This could be due to some commented out code in `src/Extract.hs`,
cutting out the type-checking phase:
```diff
-  mods' <- if needsTemplateHaskellOrQQ mods then enableCompilation mods else return mods
+  --mods' <- if needsTemplateHaskellOrQQ mods then enableCompilation mods else return mods

-  let sortedMods = flattenSCCs (topSortModuleGraph False mods' Nothing)
-  reverse <$> mapM (loadModPlugins >=> parseModule >=> typecheckModule >=> loadModule) sortedMods
+  let sortedMods = flattenSCCs
+#if __GLASGOW_HASKELL__ >= 901
+                     $ filterToposortToModules
+#endif
+                     $ topSortModuleGraph False mods Nothing
+  reverse <$> mapM (loadModPlugins >=> parseModule) sortedMods
```

Test failure:
```
test/extract/th/Foo.hs:8:7: warning: [-Woperator-whitespace-ext-conflict]
    The prefix use of a ‘$’ would denote an untyped splice
      were the TemplateHaskell extension enabled.
    Suggested fix: add whitespace after the ‘$’.
  |
8 | foo = $(bar)
  |       ^

test/extract/th/Foo.hs:8:7: error:
    parse error on input ‘$’
    Perhaps you intended to use TemplateHaskell
  |
8 | foo = $(bar)
  |       ^

Failures:

  test/ExtractSpec.hs:91:5:
  1) Extract, extract (regression tests), works with a module that splices in an expression from an other module
       uncaught exception: ExitCode
       ExitFailure 1

  To rerun use: --match "/Extract/extract (regression tests)/works with a module that splices in an expression from an other module/"

Randomized with seed 107198347
```
@andreasabel andreasabel added ghc-9.2 info needed More information needed from issue reporter and removed info needed More information needed from issue reporter labels Oct 31, 2021
andreasabel added a commit that referenced this issue Nov 7, 2021
Based on the head.hackage patch by Ryan Scott, with a fix by Matthew Pickering.
CI upgraded to use ghcup for 9.2 and 8.10.7 by Andreas Abel, following haskell-ci.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants