Simon Peyton Jones pushed to branch wip/T26681 at Glasgow Haskell Compiler / GHC
Commits:
-
c72ddabf
by Cheng Shao at 2025-12-23T16:13:23-05:00
-
0fd6d8e4
by Cheng Shao at 2025-12-23T16:14:05-05:00
-
81d10134
by Cheng Shao at 2025-12-24T06:11:52-05:00
-
fb1381c3
by Wolfgang Jeltsch at 2025-12-24T06:12:34-05:00
-
cbd234a7
by Simon Peyton Jones at 2025-12-24T11:52:09+00:00
15 changed files:
- .gitlab/ci.sh
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- configure.ac
- hadrian/cabal.project
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/ghc-internal/configure.ac
- − m4/find_ghc_bootstrap_prog.m4
- − m4/fp_copy_shellvar.m4
- − m4/fp_prog_ld_flag.m4
- − m4/fp_prog_sort.m4
- m4/prep_target_file.m4
- rts/configure.ac
- + testsuite/tests/simplCore/should_compile/T26681.hs
- testsuite/tests/simplCore/should_compile/all.T
Changes:
| ... | ... | @@ -8,7 +8,7 @@ set -Eeuo pipefail |
| 8 | 8 | |
| 9 | 9 | # Configuration:
|
| 10 | 10 | # N.B. You may want to also update the index-state in hadrian/cabal.project.
|
| 11 | -HACKAGE_INDEX_STATE="2025-01-27T17:45:32Z"
|
|
| 11 | +HACKAGE_INDEX_STATE="2025-12-19T19:24:24Z"
|
|
| 12 | 12 | MIN_HAPPY_VERSION="1.20"
|
| 13 | 13 | MIN_ALEX_VERSION="3.2.6"
|
| 14 | 14 |
| ... | ... | @@ -339,8 +339,7 @@ basicKnownKeyNames |
| 339 | 339 | getFieldName, setFieldName,
|
| 340 | 340 | |
| 341 | 341 | -- List operations
|
| 342 | - concatName, filterName, mapName,
|
|
| 343 | - zipName, foldrName, buildName, augmentName, appendName,
|
|
| 342 | + mapName, foldrName, buildName, augmentName,
|
|
| 344 | 343 | |
| 345 | 344 | -- FFI primitive types that are not wired-in.
|
| 346 | 345 | stablePtrTyConName, ptrTyConName, funPtrTyConName, constPtrConName,
|
| ... | ... | @@ -694,9 +693,8 @@ ltTag_RDR = nameRdrName ordLTDataConName |
| 694 | 693 | eqTag_RDR = nameRdrName ordEQDataConName
|
| 695 | 694 | gtTag_RDR = nameRdrName ordGTDataConName
|
| 696 | 695 | |
| 697 | -map_RDR, append_RDR :: RdrName
|
|
| 696 | +map_RDR :: RdrName
|
|
| 698 | 697 | map_RDR = nameRdrName mapName
|
| 699 | -append_RDR = nameRdrName appendName
|
|
| 700 | 698 | |
| 701 | 699 | foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR
|
| 702 | 700 | :: RdrName
|
| ... | ... | @@ -1068,7 +1066,7 @@ considerAccessibleName = varQual gHC_INTERNAL_EXTS (fsLit "considerAccessible") |
| 1068 | 1066 | |
| 1069 | 1067 | -- Random GHC.Internal.Base functions
|
| 1070 | 1068 | fromStringName, otherwiseIdName, foldrName, buildName, augmentName,
|
| 1071 | - mapName, appendName, assertName,
|
|
| 1069 | + mapName, assertName,
|
|
| 1072 | 1070 | dollarName :: Name
|
| 1073 | 1071 | dollarName = varQual gHC_INTERNAL_BASE (fsLit "$") dollarIdKey
|
| 1074 | 1072 | otherwiseIdName = varQual gHC_INTERNAL_BASE (fsLit "otherwise") otherwiseIdKey
|
| ... | ... | @@ -1076,7 +1074,6 @@ foldrName = varQual gHC_INTERNAL_BASE (fsLit "foldr") foldrIdKey |
| 1076 | 1074 | buildName = varQual gHC_INTERNAL_BASE (fsLit "build") buildIdKey
|
| 1077 | 1075 | augmentName = varQual gHC_INTERNAL_BASE (fsLit "augment") augmentIdKey
|
| 1078 | 1076 | mapName = varQual gHC_INTERNAL_BASE (fsLit "map") mapIdKey
|
| 1079 | -appendName = varQual gHC_INTERNAL_BASE (fsLit "++") appendIdKey
|
|
| 1080 | 1077 | assertName = varQual gHC_INTERNAL_BASE (fsLit "assert") assertIdKey
|
| 1081 | 1078 | fromStringName = varQual gHC_INTERNAL_DATA_STRING (fsLit "fromString") fromStringClassOpKey
|
| 1082 | 1079 | |
| ... | ... | @@ -1409,12 +1406,6 @@ enumFromThenName = varQual gHC_INTERNAL_ENUM (fsLit "enumFromThen") enumFrom |
| 1409 | 1406 | enumFromThenToName = varQual gHC_INTERNAL_ENUM (fsLit "enumFromThenTo") enumFromThenToClassOpKey
|
| 1410 | 1407 | boundedClassName = clsQual gHC_INTERNAL_ENUM (fsLit "Bounded") boundedClassKey
|
| 1411 | 1408 | |
| 1412 | --- List functions
|
|
| 1413 | -concatName, filterName, zipName :: Name
|
|
| 1414 | -concatName = varQual gHC_INTERNAL_LIST (fsLit "concat") concatIdKey
|
|
| 1415 | -filterName = varQual gHC_INTERNAL_LIST (fsLit "filter") filterIdKey
|
|
| 1416 | -zipName = varQual gHC_INTERNAL_LIST (fsLit "zip") zipIdKey
|
|
| 1417 | - |
|
| 1418 | 1409 | -- Overloaded lists
|
| 1419 | 1410 | isListClassName, fromListName, fromListNName, toListName :: Name
|
| 1420 | 1411 | isListClassName = clsQual gHC_INTERNAL_IS_LIST (fsLit "IsList") isListClassKey
|
| ... | ... | @@ -2201,7 +2192,7 @@ naturalNBDataConKey = mkPreludeDataConUnique 124 |
| 2201 | 2192 | ************************************************************************
|
| 2202 | 2193 | -}
|
| 2203 | 2194 | |
| 2204 | -wildCardKey, absentErrorIdKey, absentConstraintErrorIdKey, augmentIdKey, appendIdKey,
|
|
| 2195 | +wildCardKey, absentErrorIdKey, absentConstraintErrorIdKey, augmentIdKey,
|
|
| 2205 | 2196 | buildIdKey, foldrIdKey, recSelErrorIdKey,
|
| 2206 | 2197 | seqIdKey, eqStringIdKey,
|
| 2207 | 2198 | noMethodBindingErrorIdKey, nonExhaustiveGuardsErrorIdKey,
|
| ... | ... | @@ -2218,7 +2209,6 @@ wildCardKey = mkPreludeMiscIdUnique 0 -- See Note [WildCard |
| 2218 | 2209 | absentErrorIdKey = mkPreludeMiscIdUnique 1
|
| 2219 | 2210 | absentConstraintErrorIdKey = mkPreludeMiscIdUnique 2
|
| 2220 | 2211 | augmentIdKey = mkPreludeMiscIdUnique 3
|
| 2221 | -appendIdKey = mkPreludeMiscIdUnique 4
|
|
| 2222 | 2212 | buildIdKey = mkPreludeMiscIdUnique 5
|
| 2223 | 2213 | foldrIdKey = mkPreludeMiscIdUnique 6
|
| 2224 | 2214 | recSelErrorIdKey = mkPreludeMiscIdUnique 7
|
| ... | ... | @@ -2247,13 +2237,9 @@ divIntIdKey = mkPreludeMiscIdUnique 26 |
| 2247 | 2237 | modIntIdKey = mkPreludeMiscIdUnique 27
|
| 2248 | 2238 | cstringLengthIdKey = mkPreludeMiscIdUnique 28
|
| 2249 | 2239 | |
| 2250 | -concatIdKey, filterIdKey, zipIdKey,
|
|
| 2251 | - bindIOIdKey, returnIOIdKey, newStablePtrIdKey,
|
|
| 2240 | +bindIOIdKey, returnIOIdKey, newStablePtrIdKey,
|
|
| 2252 | 2241 | printIdKey, nullAddrIdKey, voidArgIdKey,
|
| 2253 | 2242 | otherwiseIdKey, assertIdKey :: Unique
|
| 2254 | -concatIdKey = mkPreludeMiscIdUnique 31
|
|
| 2255 | -filterIdKey = mkPreludeMiscIdUnique 32
|
|
| 2256 | -zipIdKey = mkPreludeMiscIdUnique 33
|
|
| 2257 | 2243 | bindIOIdKey = mkPreludeMiscIdUnique 34
|
| 2258 | 2244 | returnIOIdKey = mkPreludeMiscIdUnique 35
|
| 2259 | 2245 | newStablePtrIdKey = mkPreludeMiscIdUnique 36
|
| ... | ... | @@ -91,6 +91,7 @@ import GHC.Core.Utils |
| 91 | 91 | import GHC.Core.Opt.Arity ( exprBotStrictness_maybe, isOneShotBndr )
|
| 92 | 92 | import GHC.Core.FVs -- all of it
|
| 93 | 93 | import GHC.Core.Subst
|
| 94 | +import GHC.Core.TyCo.Subst( lookupTyVar )
|
|
| 94 | 95 | import GHC.Core.Make ( sortQuantVars )
|
| 95 | 96 | import GHC.Core.Type ( Type, tyCoVarsOfType
|
| 96 | 97 | , mightBeUnliftedType, closeOverKindsDSet
|
| ... | ... | @@ -466,8 +467,8 @@ lvlCase env scrut_fvs scrut' case_bndr ty alts |
| 466 | 467 | ty' = substTyUnchecked (le_subst env) ty
|
| 467 | 468 | |
| 468 | 469 | incd_lvl = incMinorLvl (le_ctxt_lvl env)
|
| 469 | - dest_lvl = maxFvLevel (const True) env scrut_fvs
|
|
| 470 | - -- Don't abstract over type variables, hence const True
|
|
| 470 | + dest_lvl = maxFvLevel includeTyVars env scrut_fvs
|
|
| 471 | + -- Don't abstract over type variables, hence includeTyVars
|
|
| 471 | 472 | |
| 472 | 473 | lvl_alt alts_env (AnnAlt con bs rhs)
|
| 473 | 474 | = do { rhs' <- lvlMFE new_env True rhs
|
| ... | ... | @@ -719,8 +720,11 @@ hasFreeJoin :: LevelEnv -> DVarSet -> Bool |
| 719 | 720 | -- (In the latter case it won't be a join point any more.)
|
| 720 | 721 | -- Not treating top-level ones specially had a massive effect
|
| 721 | 722 | -- on nofib/minimax/Prog.prog
|
| 722 | -hasFreeJoin env fvs
|
|
| 723 | - = not (maxFvLevel isJoinId env fvs == tOP_LEVEL)
|
|
| 723 | +hasFreeJoin env fvs = anyDVarSet bad_join fvs
|
|
| 724 | + where
|
|
| 725 | + bad_join v = isJoinId v &&
|
|
| 726 | + maxIn True env v tOP_LEVEL /= tOP_LEVEL
|
|
| 727 | + |
|
| 724 | 728 | |
| 725 | 729 | {- Note [Saving work]
|
| 726 | 730 | ~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -1607,10 +1611,10 @@ destLevel env fvs fvs_ty is_function is_bot |
| 1607 | 1611 | |
| 1608 | 1612 | | otherwise = max_fv_id_level
|
| 1609 | 1613 | where
|
| 1610 | - max_fv_id_level = maxFvLevel isId env fvs -- Max over Ids only; the
|
|
| 1611 | - -- tyvars will be abstracted
|
|
| 1614 | + max_fv_id_level = maxFvLevel idsOnly env fvs -- Max over Ids only; the
|
|
| 1615 | + -- tyvars will be abstracted
|
|
| 1612 | 1616 | |
| 1613 | - as_far_as_poss = maxFvLevel' isId env fvs_ty
|
|
| 1617 | + as_far_as_poss = maxFvLevel' idsOnly env fvs_ty
|
|
| 1614 | 1618 | -- See Note [Floating and kind casts]
|
| 1615 | 1619 | |
| 1616 | 1620 | {- Note [Floating and kind casts]
|
| ... | ... | @@ -1768,28 +1772,48 @@ extendCaseBndrEnv le@(LE { le_subst = subst, le_env = id_env }) |
| 1768 | 1772 | , le_env = add_id id_env (case_bndr, scrut_var) }
|
| 1769 | 1773 | extendCaseBndrEnv env _ _ = env
|
| 1770 | 1774 | |
| 1771 | -maxFvLevel :: (Var -> Bool) -> LevelEnv -> DVarSet -> Level
|
|
| 1772 | -maxFvLevel max_me env var_set
|
|
| 1773 | - = nonDetStrictFoldDVarSet (maxIn max_me env) tOP_LEVEL var_set
|
|
| 1775 | +includeTyVars, idsOnly :: Bool
|
|
| 1776 | +idsOnly = False
|
|
| 1777 | +includeTyVars = True
|
|
| 1778 | + |
|
| 1779 | +maxFvLevel :: Bool -> LevelEnv -> DVarSet -> Level
|
|
| 1780 | +maxFvLevel include_tyvars env var_set
|
|
| 1781 | + = nonDetStrictFoldDVarSet (maxIn include_tyvars env) tOP_LEVEL var_set
|
|
| 1774 | 1782 | -- It's OK to use a non-deterministic fold here because maxIn commutes.
|
| 1775 | 1783 | |
| 1776 | -maxFvLevel' :: (Var -> Bool) -> LevelEnv -> TyCoVarSet -> Level
|
|
| 1784 | +maxFvLevel' :: Bool -> LevelEnv -> TyCoVarSet -> Level
|
|
| 1777 | 1785 | -- Same but for TyCoVarSet
|
| 1778 | -maxFvLevel' max_me env var_set
|
|
| 1779 | - = nonDetStrictFoldUniqSet (maxIn max_me env) tOP_LEVEL var_set
|
|
| 1786 | +maxFvLevel' include_tyvars env var_set
|
|
| 1787 | + = nonDetStrictFoldUniqSet (maxIn include_tyvars env) tOP_LEVEL var_set
|
|
| 1780 | 1788 | -- It's OK to use a non-deterministic fold here because maxIn commutes.
|
| 1781 | 1789 | |
| 1782 | -maxIn :: (Var -> Bool) -> LevelEnv -> InVar -> Level -> Level
|
|
| 1783 | -maxIn max_me (LE { le_lvl_env = lvl_env, le_env = id_env }) in_var lvl
|
|
| 1790 | +maxIn :: Bool -> LevelEnv -> InVar -> Level -> Level
|
|
| 1791 | +-- True <=> include tyvars
|
|
| 1792 | +maxIn include_tyvars env@(LE { le_subst = subst, le_env = id_env }) in_var lvl
|
|
| 1793 | + | isId in_var
|
|
| 1784 | 1794 | = case lookupVarEnv id_env in_var of
|
| 1795 | + Nothing -> maxOut env in_var lvl
|
|
| 1785 | 1796 | Just (abs_vars, _) -> foldr max_out lvl abs_vars
|
| 1786 | - Nothing -> max_out in_var lvl
|
|
| 1787 | - where
|
|
| 1788 | - max_out out_var lvl
|
|
| 1789 | - | max_me out_var = case lookupVarEnv lvl_env out_var of
|
|
| 1790 | - Just lvl' -> maxLvl lvl' lvl
|
|
| 1791 | - Nothing -> lvl
|
|
| 1792 | - | otherwise = lvl -- Ignore some vars depending on max_me
|
|
| 1797 | + where
|
|
| 1798 | + max_out out_var lvl
|
|
| 1799 | + | isTyVar out_var = if include_tyvars
|
|
| 1800 | + then maxOut env out_var lvl
|
|
| 1801 | + else lvl
|
|
| 1802 | + | otherwise = maxOut env out_var lvl
|
|
| 1803 | + |
|
| 1804 | + | include_tyvars -- TyVars
|
|
| 1805 | + = case lookupTyVar subst in_var of
|
|
| 1806 | + Just ty -> nonDetStrictFoldVarSet (maxOut env) lvl (tyCoVarsOfType ty)
|
|
| 1807 | + Nothing -> maxOut env in_var lvl
|
|
| 1808 | + |
|
| 1809 | + | otherwise -- Ignore free tyvars
|
|
| 1810 | + = lvl
|
|
| 1811 | + |
|
| 1812 | +maxOut :: LevelEnv -> OutVar -> Level -> Level
|
|
| 1813 | +maxOut (LE { le_lvl_env = lvl_env }) out_var lvl
|
|
| 1814 | + = case lookupVarEnv lvl_env out_var of
|
|
| 1815 | + Just lvl' -> maxLvl lvl' lvl
|
|
| 1816 | + Nothing -> lvl
|
|
| 1793 | 1817 | |
| 1794 | 1818 | lookupVar :: LevelEnv -> Id -> LevelledExpr
|
| 1795 | 1819 | lookupVar le v = case lookupVarEnv (le_env le) v of
|
| ... | ... | @@ -57,14 +57,10 @@ dnl ** which are needed by FP_SETUP_PROJECT_VERSION |
| 57 | 57 | |
| 58 | 58 | dnl ** Find find command (for Win32's benefit)
|
| 59 | 59 | FP_PROG_FIND
|
| 60 | -FP_PROG_SORT
|
|
| 61 | 60 | |
| 62 | 61 | dnl ----------------------------------------------------------
|
| 63 | 62 | FP_SETUP_PROJECT_VERSION
|
| 64 | 63 | |
| 65 | -# Hmmm, we fix the RPM release number to 1 here... Is this convenient?
|
|
| 66 | -AC_SUBST([release], [1])
|
|
| 67 | - |
|
| 68 | 64 | dnl * We require autoconf version 2.69 due to
|
| 69 | 65 | dnl https://bugs.ruby-lang.org/issues/8179. Also see #14910.
|
| 70 | 66 | dnl * We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
|
| ... | ... | @@ -249,9 +245,6 @@ then |
| 249 | 245 | fi
|
| 250 | 246 | AC_SUBST([WithGhc])
|
| 251 | 247 | |
| 252 | -dnl ** Without optimization some INLINE trickery fails for GHCi
|
|
| 253 | -SRC_CC_OPTS="-O"
|
|
| 254 | - |
|
| 255 | 248 | dnl--------------------------------------------------------------------
|
| 256 | 249 | dnl * Choose host(/target/build) platform
|
| 257 | 250 | dnl--------------------------------------------------------------------
|
| ... | ... | @@ -753,10 +746,6 @@ AC_PROG_LN_S |
| 753 | 746 | dnl ** Find the path to sed
|
| 754 | 747 | AC_PATH_PROGS(SedCmd,gsed sed,sed)
|
| 755 | 748 | |
| 756 | - |
|
| 757 | -dnl ** check for time command
|
|
| 758 | -AC_PATH_PROG(TimeCmd,time)
|
|
| 759 | - |
|
| 760 | 749 | dnl ** check for tar
|
| 761 | 750 | dnl if GNU tar is named gtar, look for it first.
|
| 762 | 751 | AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar)
|
| ... | ... | @@ -4,11 +4,11 @@ packages: ./ |
| 4 | 4 | |
| 5 | 5 | -- This essentially freezes the build plan for hadrian
|
| 6 | 6 | -- It would be wise to keep this up to date with the state set in .gitlab/ci.sh.
|
| 7 | -index-state: 2025-01-27T17:45:32Z
|
|
| 7 | +index-state: 2025-12-19T19:24:24Z
|
|
| 8 | 8 | |
| 9 | --- unordered-containers-0.2.20-r1 requires template-haskell < 2.22
|
|
| 10 | --- ghc-9.10 has template-haskell-2.22.0.0
|
|
| 11 | -allow-newer: unordered-containers:template-haskell
|
|
| 9 | +-- Fixes bootstrapping with ghc-9.14
|
|
| 10 | +allow-newer: all:base, all:ghc-bignum, all:template-haskell
|
|
| 11 | +constraints: hashable >= 1.5.0.0
|
|
| 12 | 12 | |
| 13 | 13 | -- N.B. Compile with -O0 since this is not a performance-critical executable
|
| 14 | 14 | -- and the Cabal takes nearly twice as long to build with -O1. See #16817.
|
| ... | ... | @@ -47,12 +47,20 @@ runTestGhcFlags = do |
| 47 | 47 | then "-optc-fno-builtin"
|
| 48 | 48 | else ""
|
| 49 | 49 | |
| 50 | + -- Also pass -keep-tmp-files to GHC when --keep-test-files is
|
|
| 51 | + -- passed to hadrian for debugging purpose (#26688)
|
|
| 52 | + keepFiles <- testKeepFiles <$> userSetting defaultTestArgs
|
|
| 53 | + let keepTmpFilesFlag
|
|
| 54 | + | keepFiles = "-keep-tmp-files"
|
|
| 55 | + | otherwise = ""
|
|
| 56 | + |
|
| 50 | 57 | -- Take flags to send to the Haskell compiler from test.mk.
|
| 51 | 58 | -- See: https://github.com/ghc/ghc/blob/master/testsuite/mk/test.mk#L37
|
| 52 | 59 | unwords <$> sequence
|
| 53 | 60 | [ pure " -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -fno-dump-with-ways -fprint-error-index-links=never -rtsopts"
|
| 54 | 61 | , pure ghcOpts
|
| 55 | 62 | , pure ghcExtraFlags
|
| 63 | + , pure keepTmpFilesFlag
|
|
| 56 | 64 | , ifMinGhcVer "711" "-fno-warn-missed-specialisations"
|
| 57 | 65 | , ifMinGhcVer "711" "-fshow-warning-groups"
|
| 58 | 66 | , ifMinGhcVer "801" "-fdiagnostics-color=never"
|
| ... | ... | @@ -23,7 +23,7 @@ AC_MSG_RESULT($WINDOWS) |
| 23 | 23 | AC_CHECK_TYPES([long long])
|
| 24 | 24 | |
| 25 | 25 | # check for specific header (.h) files that we are interested in
|
| 26 | -AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/file.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h sys/socket.h])
|
|
| 26 | +AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h sys/socket.h])
|
|
| 27 | 27 | |
| 28 | 28 | # Enable large file support. Do this before testing the types ino_t, off_t, and
|
| 29 | 29 | # rlim_t, because it will affect the result of that test.
|
| 1 | -# FIND_GHC_BOOTSTRAP_PROG()
|
|
| 2 | -# --------------------------------
|
|
| 3 | -# Parse the bootstrap GHC's compiler settings file for the location of things
|
|
| 4 | -# like the `llc` and `opt` commands.
|
|
| 5 | -#
|
|
| 6 | -# $1 = the variable to set
|
|
| 7 | -# $2 = The bootstrap compiler.
|
|
| 8 | -# $3 = The string to grep for to find the correct line.
|
|
| 9 | -#
|
|
| 10 | -AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[
|
|
| 11 | - BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'`
|
|
| 12 | - if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then
|
|
| 13 | - AC_PATH_PROG([$1], [$BootstrapTmpCmd], "")
|
|
| 14 | - else
|
|
| 15 | - $1=$BootstrapTmpCmd
|
|
| 16 | - fi
|
|
| 17 | -]) |
| 1 | -# Helper for cloning a shell variable's state
|
|
| 2 | -AC_DEFUN([FP_COPY_SHELLVAR],
|
|
| 3 | -[if test -n "${$1+set}"; then $2="$$1"; else unset $2; fi ]) |
| 1 | -# FP_PROG_LD_FLAG
|
|
| 2 | -# ---------------
|
|
| 3 | -# Sets the output variable $2 to $1 if ld supports the $1 flag.
|
|
| 4 | -# Otherwise the variable's value is empty.
|
|
| 5 | -AC_DEFUN([FP_PROG_LD_FLAG],
|
|
| 6 | -[
|
|
| 7 | -AC_CACHE_CHECK([whether ld understands $1], [fp_cv_$2],
|
|
| 8 | -[echo 'int foo() { return 0; }' > conftest.c
|
|
| 9 | -${CC-cc} -c conftest.c
|
|
| 10 | -if $LD -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then
|
|
| 11 | - fp_cv_$2=$1
|
|
| 12 | -else
|
|
| 13 | - fp_cv_$2=
|
|
| 14 | -fi
|
|
| 15 | -rm -rf conftest*])
|
|
| 16 | -$2=$fp_cv_$2
|
|
| 17 | -])# FP_PROG_LD_FLAG |
| 1 | -# FP_PROG_SORT
|
|
| 2 | -# ------------
|
|
| 3 | -# Find a Unix-like sort
|
|
| 4 | -AC_DEFUN([FP_PROG_SORT],
|
|
| 5 | -[AC_PATH_PROG([fp_prog_sort], [sort])
|
|
| 6 | -echo conwip > conftest.txt
|
|
| 7 | -$fp_prog_sort -f conftest.txt > conftest.out 2>&1
|
|
| 8 | -if grep 'conwip' conftest.out > /dev/null 2>&1 ; then
|
|
| 9 | - # The goods
|
|
| 10 | - SortCmd="$fp_prog_sort"
|
|
| 11 | -else
|
|
| 12 | - # Summink else..pick next one.
|
|
| 13 | - AC_MSG_WARN([$fp_prog_sort looks like a non-*nix sort, ignoring it])
|
|
| 14 | - FP_CHECK_PROG([SortCmd], [sort], [], [], [$fp_prog_sort])
|
|
| 15 | -fi
|
|
| 16 | -rm -f conftest.txt conftest.out
|
|
| 17 | -AC_SUBST([SortCmd])[]dnl
|
|
| 18 | -])# FP_PROG_SORT |
| ... | ... | @@ -229,5 +229,3 @@ AC_DEFUN([PREP_TARGET_FILE],[ |
| 229 | 229 | esac
|
| 230 | 230 | AC_SUBST([TargetEndianness])
|
| 231 | 231 | ]) |
| 232 | - |
|
| 233 | -AC_DEFUN() |
| ... | ... | @@ -96,7 +96,7 @@ dnl off_t, because it will affect the result of that test. |
| 96 | 96 | AC_SYS_LARGEFILE
|
| 97 | 97 | |
| 98 | 98 | dnl ** check for specific header (.h) files that we are interested in
|
| 99 | -AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h])
|
|
| 99 | +AC_CHECK_HEADERS([ctype.h dlfcn.h errno.h fcntl.h limits.h locale.h nlist.h pthread.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h])
|
|
| 100 | 100 | |
| 101 | 101 | dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708
|
| 102 | 102 | AC_CHECK_HEADERS([sys/cpuset.h], [], [],
|
| ... | ... | @@ -148,7 +148,7 @@ FP_CHECK_FUNC([GetModuleFileName], |
| 148 | 148 | |
| 149 | 149 | dnl ** check for more functions
|
| 150 | 150 | dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
|
| 151 | -AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity sched_getaffinity setlocale uselocale])
|
|
| 151 | +AC_CHECK_FUNCS([getclock getrusage gettimeofday sysconf times ctime_r sched_setaffinity sched_getaffinity uselocale])
|
|
| 152 | 152 | |
| 153 | 153 | dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
|
| 154 | 154 | dnl ** _POSIX_C_SOURCE is defined
|
| ... | ... | @@ -488,5 +488,3 @@ cat ghcautoconf.h.autoconf | sed \ |
| 488 | 488 | >> include/ghcautoconf.h
|
| 489 | 489 | echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h
|
| 490 | 490 | ] |
| 491 | - |
|
| 492 | - |
| 1 | +{-# LANGUAGE BangPatterns #-}
|
|
| 2 | +{-# LANGUAGE DataKinds #-}
|
|
| 3 | +{-# LANGUAGE GADTs #-}
|
|
| 4 | +{-# LANGUAGE PolyKinds #-}
|
|
| 5 | +{-# LANGUAGE ScopedTypeVariables #-}
|
|
| 6 | +{-# LANGUAGE StandaloneKindSignatures #-}
|
|
| 7 | +{-# LANGUAGE TypeApplications #-}
|
|
| 8 | +{-# LANGUAGE TypeFamilies #-}
|
|
| 9 | +{-# LANGUAGE TypeOperators #-}
|
|
| 10 | + |
|
| 11 | +module T26681 where
|
|
| 12 | + |
|
| 13 | +import Data.Kind (Type)
|
|
| 14 | +import Data.Type.Equality
|
|
| 15 | +import GHC.TypeLits
|
|
| 16 | +import qualified Unsafe.Coerce
|
|
| 17 | + |
|
| 18 | + |
|
| 19 | +{-# NOINLINE unsafeCoerceRefl #-}
|
|
| 20 | +unsafeCoerceRefl :: a :~: b
|
|
| 21 | +unsafeCoerceRefl = Unsafe.Coerce.unsafeCoerce Refl
|
|
| 22 | + |
|
| 23 | +type family MapJust l where
|
|
| 24 | + MapJust '[] = '[]
|
|
| 25 | + MapJust (x : xs) = Just x : MapJust xs
|
|
| 26 | + |
|
| 27 | +type family Tail l where
|
|
| 28 | + Tail (_ : xs) = xs
|
|
| 29 | + |
|
| 30 | +lemMapJustCons :: MapJust sh :~: Just n : sh' -> sh :~: n : Tail sh
|
|
| 31 | +lemMapJustCons Refl = unsafeCoerceRefl
|
|
| 32 | + |
|
| 33 | + |
|
| 34 | +type ListX :: [Maybe Nat] -> (Maybe Nat -> Type) -> Type
|
|
| 35 | +data ListX sh f where
|
|
| 36 | + ConsX :: !(f n) -> ListX (n : sh) f
|
|
| 37 | + |
|
| 38 | + |
|
| 39 | +data JustN n where
|
|
| 40 | + JustN :: JustN (Just n)
|
|
| 41 | + |
|
| 42 | +data UnconsListSRes f sh1 = forall n sh. (n : sh ~ sh1) => UnconsListSRes
|
|
| 43 | + |
|
| 44 | +listsUncons :: forall sh1 f. ListX (MapJust sh1) JustN -> UnconsListSRes f sh1
|
|
| 45 | +listsUncons (ConsX JustN)
|
|
| 46 | + | Refl <- lemMapJustCons @sh1 Refl
|
|
| 47 | + = UnconsListSRes |
| ... | ... | @@ -563,3 +563,4 @@ test('T26115', [grep_errmsg(r'DFun')], compile, ['-O -ddump-simpl -dsuppress-uni |
| 563 | 563 | test('T26116', normal, compile, ['-O -ddump-rules'])
|
| 564 | 564 | test('T26117', [grep_errmsg(r'==')], compile, ['-O -ddump-simpl -dsuppress-uniques'])
|
| 565 | 565 | test('T26349', normal, compile, ['-O -ddump-rules'])
|
| 566 | +test('T26681', normal, compile, ['-O']) |