[Git][ghc/ghc][wip/andreask/bump_time] 5 commits: gitlab-ci: Fix copy-paste error

Andreas Klebinger gitlab at gitlab.haskell.org
Mon Dec 7 12:14:41 UTC 2020



Andreas Klebinger pushed to branch wip/andreask/bump_time at Glasgow Haskell Compiler / GHC


Commits:
e0b08c5f by Ben Gamari at 2020-12-03T13:01:47-05:00
gitlab-ci: Fix copy-paste error

Also be more consistent in quoting.

- - - - -
33ec3a06 by Ben Gamari at 2020-12-03T23:11:31-05:00
gitlab-ci: Run linters through ci.sh

Ensuring that the right toolchain is used.

- - - - -
4a437bc1 by Shayne Fletcher at 2020-12-05T09:06:38-05:00
Fix bad span calculations of post qualified imports

- - - - -
8fac4b93 by Ben Gamari at 2020-12-05T09:07:13-05:00
testsuite: Add a test for #18923

- - - - -
8bcdb940 by Andreas Klebinger at 2020-12-07T07:14:38-05:00
Bump time submodule.

This should fix #19002.

- - - - -


9 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- compiler/GHC/Parser.y
- libraries/time
- testsuite/tests/module/all.T
- + testsuite/tests/module/mod185.hs
- + testsuite/tests/module/mod185.stderr
- + testsuite/tests/perf/compiler/T18923.hs
- testsuite/tests/perf/compiler/all.T


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -299,12 +299,11 @@ hadrian-ghc-in-ghci:
   tags:
     - x86_64-linux
   script:
+    - git clean -xdf && git submodule foreach git clean -xdf
     - .gitlab/ci.sh setup
+    - .gitlab/ci.sh configure
     - cabal update
     - cd hadrian; cabal new-build -j`../mk/detect-cpu-count.sh` --with-compiler=$GHC --project-file=ci.project; cd ..
-    - git clean -xdf && git submodule foreach git clean -xdf
-    - ./boot
-    - ./configure $CONFIGURE_ARGS
     # Load ghc-in-ghci then immediately exit and check the modules loaded
     - echo ":q" | hadrian/ghci -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok,"
   after_script:
@@ -345,9 +344,13 @@ hadrian-ghc-in-ghci:
 
 lint-base:
   extends: .lint-params
+  variables:
+    BUILD_FLAVOUR: default
   script:
-    - hadrian/build -c -j stage1:lib:base
-    - hadrian/build -j lint:base
+    - .gitlab/ci.sh setup
+    - .gitlab/ci.sh configure
+    - .gitlab/ci.sh run_hadrian stage1:lib:base
+    - .gitlab/ci.sh run_hadrian lint:base
 
 ############################################################
 # Validation via Pipelines (make)


=====================================
.gitlab/ci.sh
=====================================
@@ -168,13 +168,13 @@ function show_tool() {
 }
 
 function set_toolchain_paths() {
-  needs_toolchain=1
+  needs_toolchain="1"
   case "$(uname)" in
     Linux) needs_toolchain="0" ;;
     *) ;;
   esac
 
-  if [[ "$needs_toolchain" = 1 ]]; then
+  if [[ "$needs_toolchain" = "1" ]]; then
       # These are populated by setup_toolchain
       GHC="$toolchain/bin/ghc$exe"
       CABAL="$toolchain/bin/cabal$exe"
@@ -185,9 +185,9 @@ function set_toolchain_paths() {
       # we provide these handy fallbacks in case the
       # script isn't run from within a GHC CI docker image.
       if [ -z "$GHC" ]; then GHC="$(which ghc)"; fi
-      if [ -z "$CABAL" ]; then GHC="$(which cabal)"; fi
-      if [ -z "$HAPPY" ]; then GHC="$(which happy)"; fi
-      if [ -z "$ALEX" ]; then GHC="$(which alex)"; fi
+      if [ -z "$CABAL" ]; then CABAL="$(which cabal)"; fi
+      if [ -z "$HAPPY" ]; then HAPPY="$(which happy)"; fi
+      if [ -z "$ALEX" ]; then ALEX="$(which alex)"; fi
   fi
 
   export GHC
@@ -204,7 +204,7 @@ function setup() {
       cp -Rf cabal-cache/* "$cabal_dir"
   fi
 
-  if [[ -n "$needs_toolchain" ]]; then
+  if [[ "$needs_toolchain" = "1" ]]; then
     setup_toolchain
   fi
   case "$(uname)" in
@@ -442,9 +442,6 @@ function test_make() {
 }
 
 function build_hadrian() {
-  if [ -z "$BUILD_FLAVOUR" ]; then
-    fail "BUILD_FLAVOUR not set"
-  fi
   if [ -z "$BIN_DIST_NAME" ]; then
     fail "BIN_DIST_NAME not set"
   fi
@@ -506,6 +503,9 @@ function clean() {
 }
 
 function run_hadrian() {
+  if [ -z "$BUILD_FLAVOUR" ]; then
+    fail "BUILD_FLAVOUR not set"
+  fi
   if [ -z "$BIGNUM_BACKEND" ]; then BIGNUM_BACKEND="gmp"; fi
   if [ -n "$VERBOSE" ]; then HADRIAN_ARGS="$HADRIAN_ARGS -V"; fi
   run hadrian/build-cabal \
@@ -575,7 +575,7 @@ case $1 in
     test_hadrian || res=$?
     push_perf_notes
     exit $res ;;
-  run_hadrian) run_hadrian $@ ;;
+  run_hadrian) shift; run_hadrian $@ ;;
   perf_test) run_perf_test ;;
   clean) clean ;;
   shell) shell $@ ;;


=====================================
compiler/GHC/Parser.y
=====================================
@@ -1057,18 +1057,20 @@ importdecls_semi
 importdecl :: { LImportDecl GhcPs }
         : 'import' maybe_src maybe_safe optqualified maybe_pkg modid optqualified maybeas maybeimpspec
                 {% do {
-                  ; checkImportDecl $4 $7
-                  ; ams (L (comb4 $1 $6 (snd $8) $9) $
+                  ; let { ; mPreQual = unLoc $4
+                          ; mPostQual = unLoc $7 }
+                  ; checkImportDecl mPreQual mPostQual
+                  ; ams (L (comb5 $1 $6 $7 (snd $8) $9) $
                       ImportDecl { ideclExt = noExtField
                                   , ideclSourceSrc = snd $ fst $2
                                   , ideclName = $6, ideclPkgQual = snd $5
                                   , ideclSource = snd $2, ideclSafe = snd $3
-                                  , ideclQualified = importDeclQualifiedStyle $4 $7
+                                  , ideclQualified = importDeclQualifiedStyle mPreQual mPostQual
                                   , ideclImplicit = False
                                   , ideclAs = unLoc (snd $8)
                                   , ideclHiding = unLoc $9 })
-                         (mj AnnImport $1 : fst (fst $2) ++ fst $3 ++ fmap (mj AnnQualified) (maybeToList $4)
-                                          ++ fst $5 ++ fmap (mj AnnQualified) (maybeToList $7) ++ fst $8)
+                         (mj AnnImport $1 : fst (fst $2) ++ fst $3 ++ fmap (mj AnnQualified) (maybeToList mPreQual)
+                                          ++ fst $5 ++ fmap (mj AnnQualified) (maybeToList mPostQual) ++ fst $8)
                   }
                 }
 
@@ -1089,9 +1091,9 @@ maybe_pkg :: { ([AddAnn],Maybe StringLiteral) }
                         ; return ([mj AnnPackageName $1], Just (StringLiteral (getSTRINGs $1) pkgFS)) } }
         | {- empty -}                           { ([],Nothing) }
 
-optqualified :: { Maybe (Located Token) }
-        : 'qualified'                           { Just $1 }
-        | {- empty -}                           { Nothing }
+optqualified :: { Located (Maybe (Located Token)) }
+        : 'qualified'                           { sL1 $1 (Just $1) }
+        | {- empty -}                           { noLoc Nothing }
 
 maybeas :: { ([AddAnn],Located (Maybe (Located ModuleName))) }
         : 'as' modid                           { ([mj AnnAs $1]
@@ -3861,6 +3863,11 @@ comb4 a b c d = a `seq` b `seq` c `seq` d `seq`
     (combineSrcSpans (getLoc a) $ combineSrcSpans (getLoc b) $
                 combineSrcSpans (getLoc c) (getLoc d))
 
+comb5 :: Located a -> Located b -> Located c -> Located d -> Located e -> SrcSpan
+comb5 a b c d e = a `seq` b `seq` c `seq` d `seq` e `seq`
+    (combineSrcSpans (getLoc a) $ combineSrcSpans (getLoc b) $
+       combineSrcSpans (getLoc c) $ combineSrcSpans (getLoc d) (getLoc e))
+
 -- strict constructor version:
 {-# INLINE sL #-}
 sL :: SrcSpan -> a -> Located a


=====================================
libraries/time
=====================================
@@ -1 +1 @@
-Subproject commit c25d6a76702b454426e149fb590da5cb69f3bd0a
+Subproject commit df292e1a74c6a87c2c1c889679074dd46ad39461


=====================================
testsuite/tests/module/all.T
=====================================
@@ -268,6 +268,7 @@ test('mod181', normal, compile, [''])
 test('mod182', normal, compile_fail, [''])
 test('mod183', normal, compile_fail, [''])
 test('mod184', normal, compile, ['-Wprepositive-qualified-module'])
+test('mod185', normal, compile, ['-ddump-parsed-ast'])
 
 test('T1148', normal, compile, [''])
 test('T1074', normal, compile, [''])


=====================================
testsuite/tests/module/mod185.hs
=====================================
@@ -0,0 +1,5 @@
+{-# LANGUAGE ImportQualifiedPost #-}
+-- The span of the import decl should include the 'qualified' keyword.
+import Prelude qualified
+
+main = Prelude.undefined


=====================================
testsuite/tests/module/mod185.stderr
=====================================
@@ -0,0 +1,62 @@
+==================== Parser AST ====================
+
+({ mod185.hs:1:1 }
+ (HsModule
+  (VirtualBraces
+   (1))
+  (Nothing)
+  (Nothing)
+  [({ mod185.hs:3:1-24 }
+    (ImportDecl
+     (NoExtField)
+     (NoSourceText)
+     ({ mod185.hs:3:8-14 }
+      {ModuleName: Prelude})
+     (Nothing)
+     (NotBoot)
+     (False)
+     (QualifiedPost)
+     (False)
+     (Nothing)
+     (Nothing)))]
+  [({ mod185.hs:5:1-24 }
+    (ValD
+     (NoExtField)
+     (FunBind
+      (NoExtField)
+      ({ mod185.hs:5:1-4 }
+       (Unqual
+        {OccName: main}))
+      (MG
+       (NoExtField)
+       ({ mod185.hs:5:1-24 }
+        [({ mod185.hs:5:1-24 }
+          (Match
+           (NoExtField)
+           (FunRhs
+            ({ mod185.hs:5:1-4 }
+             (Unqual
+              {OccName: main}))
+            (Prefix)
+            (NoSrcStrict))
+           []
+           (GRHSs
+            (NoExtField)
+            [({ mod185.hs:5:6-24 }
+              (GRHS
+               (NoExtField)
+               []
+               ({ mod185.hs:5:8-24 }
+                (HsVar
+                 (NoExtField)
+                 ({ mod185.hs:5:8-24 }
+                  (Qual
+                   {ModuleName: Prelude}
+                   {OccName: undefined}))))))]
+            ({ <no location info> }
+             (EmptyLocalBinds
+              (NoExtField))))))])
+       (FromSource))
+      [])))]
+  (Nothing)
+  (Nothing)))


=====================================
testsuite/tests/perf/compiler/T18923.hs
=====================================
@@ -0,0 +1,16 @@
+module T18923 (mergeRec, Rec) where
+
+mayMerge :: Maybe b -> Maybe b -> Maybe b
+mayMerge Nothing  y        = y
+mayMerge x        Nothing  = x
+mayMerge (Just x) (Just y) = Just y
+
+data Rec = Rec { v0,v1,v2,v3,v4,v5,v6,v7 :: !(Maybe Bool) }
+
+mergeRec :: Rec -> Rec -> Rec
+mergeRec
+  (Rec a0 a1 a2 a3 a4 a5 a6 a7)
+  (Rec b0 b1 b2 b3 b4 b5 b6 b7) =
+    Rec (mayMerge a0 b0) (mayMerge a1 b1) (mayMerge a2 b2) (mayMerge a3 b3)
+        (mayMerge a4 b4) (mayMerge a5 b5) (mayMerge a6 b6) (mayMerge a7 b7)
+


=====================================
testsuite/tests/perf/compiler/all.T
=====================================
@@ -434,3 +434,7 @@ test ('T18223',
       ],
       compile,
       ['-v0 -O'])
+test ('T18923',
+      [ collect_compiler_stats('bytes allocated',2) ],
+      compile,
+      ['-v0 -O'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/027f49b680f6c0a300d3d27889fb709d57085b57...8bcdb940cd64709f2f5dd90128a20e61f5e5ccdb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/027f49b680f6c0a300d3d27889fb709d57085b57...8bcdb940cd64709f2f5dd90128a20e61f5e5ccdb
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/20201207/ed4335d0/attachment-0001.html>


More information about the ghc-commits mailing list