[Git][ghc/ghc][wip/backports] 3 commits: API Annotations: Fix annotation for strictness

Ben Gamari gitlab at gitlab.haskell.org
Mon Sep 21 19:27:26 UTC 2020



Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC


Commits:
f91ea170 by Alan Zimmerman at 2020-09-20T19:25:22+01:00
API Annotations: Fix annotation for strictness

This adds the correct location for a ! or ~.

It is a reconstruction of 3ccc80ee6120db7ead579c6e9fc5c2164f3bf575,
some of which got mangled in the backport process.

- - - - -
fbdc93e7 by Ben Gamari at 2020-09-21T15:27:17-04:00
Bump Win32 submodule

- - - - -
17740c20 by Ben Gamari at 2020-09-21T15:27:17-04:00
ci.sh: Enforce minimum happy/alex versions

Also, always invoke cabal-install to ensure that happy/alex symlinks are
up-to-date.

(cherry picked from commit a89c2fbab9bcf7d769e9d27262ab29f93342f114)

Modified to use happy-1.19

- - - - -


3 changed files:

- .gitlab/ci.sh
- compiler/GHC/Parser/PostProcess.hs
- libraries/Win32


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -8,6 +8,8 @@ set -e -o pipefail
 # Configuration:
 hackage_index_state="@1579718451"
 
+MIN_ALEX_VERSION="3.2"
+
 # Colors
 BLACK="0;30"
 GRAY="1;30"
@@ -168,6 +170,7 @@ function set_toolchain_paths() {
       HAPPY="$HOME/.cabal/bin/happy"
       ALEX="$HOME/.cabal/bin/alex"
   fi
+
   export GHC
   export CABAL
   export HAPPY
@@ -286,17 +289,13 @@ function setup_toolchain() {
     *) ;;
   esac
 
-  if [ ! -e "$HAPPY" ]; then
-      info "Building happy..."
-      cabal update
-      $cabal_install happy
-  fi
+  cabal update
 
-  if [ ! -e "$ALEX" ]; then
-      info "Building alex..."
-      cabal update
-      $cabal_install alex
-  fi
+  info "Building happy..."
+  $cabal_install happy --constraint="happy==1.19.*"
+
+  info "Building alex..."
+  $cabal_install alex --constraint="alex>=$MIN_ALEX_VERSION"
 }
 
 function cleanup_submodules() {


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -1374,19 +1374,24 @@ pBangTy lt@(L l1 _) xs =
     Nothing -> (False, lt, pure (), xs)
     Just (l2, anns, prag, unpk, xs') ->
       let bl = combineSrcSpans l1 l2
-          bt = addUnpackedness (prag, unpk) lt
-      in (True, L bl bt, addAnnsAt bl anns, xs')
+          (anns2, bt) = addUnpackedness (prag, unpk) lt
+      in (True, L bl bt, addAnnsAt bl (anns ++ anns2), xs')
 
 mkBangTy :: SrcStrictness -> LHsType GhcPs -> HsType GhcPs
 mkBangTy strictness =
   HsBangTy noExtField (HsSrcBang NoSourceText NoSrcUnpack strictness)
 
-addUnpackedness :: (SourceText, SrcUnpackedness) -> LHsType GhcPs -> HsType GhcPs
-addUnpackedness (prag, unpk) (L _ (HsBangTy x bang t))
+addUnpackedness :: (SourceText, SrcUnpackedness) -> LHsType GhcPs -> ([AddAnn], HsType GhcPs)
+addUnpackedness (prag, unpk) (L l (HsBangTy x bang t))
   | HsSrcBang NoSourceText NoSrcUnpack strictness <- bang
-  = HsBangTy x (HsSrcBang prag unpk strictness) t
+  = let
+      anns = case strictness of
+        SrcLazy     -> [AddAnn AnnTilde (srcSpanFirstCharacter l)]
+        SrcStrict   -> [AddAnn AnnBang  (srcSpanFirstCharacter l)]
+        NoSrcStrict -> []
+    in (anns, HsBangTy x (HsSrcBang prag unpk strictness) t)
 addUnpackedness (prag, unpk) t
-  = HsBangTy noExtField (HsSrcBang prag unpk NoSrcStrict) t
+  = ([], HsBangTy noExtField (HsSrcBang prag unpk NoSrcStrict) t)
 
 -- | Merge a /reversed/ and /non-empty/ soup of operators and operands
 --   into a type.


=====================================
libraries/Win32
=====================================
@@ -1 +1 @@
-Subproject commit ca5fbc12851b98a52f96a43ea19c54c9ecf0f9e3
+Subproject commit d68374423fa3d3edd6b776e412e4093cc69b5f64



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c4cf79e78eba57cbcc461d76d3397399d22a74d...17740c20e4c8e78add9e425910ac6546ffaeba03

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c4cf79e78eba57cbcc461d76d3397399d22a74d...17740c20e4c8e78add9e425910ac6546ffaeba03
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200921/5bf9efc4/attachment-0001.html>


More information about the ghc-commits mailing list