Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
8d2bf083 by Andreas Klebinger at 2026-01-21T00:22:53-05:00
Don't build GHC with -Wcompat
Without bumping the boot compiler the warnings it produces are often not
actionable leading to pointless noise.
Fixes #26800
- - - - -
e177aa8b by Torsten Schmits at 2026-01-21T00:22:55-05:00
Use the correct field of ModOrigin when formatting error message listing hidden reexports
- - - - -
250b8045 by Cheng Shao at 2026-01-21T00:22:56-05:00
Revert "hadrian: handle findExecutable "" gracefully"
This reverts commit 1e5752f64a522c4025365856d92f78073a7b3bba. The
underlying issue has been fixed in
https://github.com/haskell/directory/commit/75828696e7145adc09179111a0d631b9...
and present since 1.3.9.0, and hadrian directory lower bound is
1.3.9.0, so we can revert our own in house hack now.
- - - - -
34b822c1 by Cheng Shao at 2026-01-21T00:22:57-05:00
rts: fix typo in TICK_ALLOC_RTS
This patch fixes a typo in the `TICK_ALLOC_RTS` macro, the original
`bytes` argument was silently dropped. The Cmm code has its own
version of `TICK_ALLOC_RTS` not affected by this typo, it affected the
C RTS, and went unnoticed because the variable `n` happened to also be
available at its call site. But the number was incorrect. Also fixes
its call site since `WDS()` is not available in C.
- - - - -
18ce2b53 by Cheng Shao at 2026-01-21T00:22:57-05:00
rts: remove broken & unused ALLOC_P_TICKY
This patch removes the `ALLOC_P_TICKY` macro from the rts, it's
unused, and its expanded code is already broken.
- - - - -
0964ffc3 by Simon Peyton Jones at 2026-01-21T00:22:59-05:00
Make the implicit-parameter class have representational role
This MR addresses #26737, by making the built-in class IP
have a representational role for its second parameter.
See Note [IP: implicit parameter class] in
ghc-internal:GHC.Internal.Classes.IP
In fact, IP is (unfortunately, currently) exposed by
base:GHC.Base, so we ran a quick CLC proposal to
agree the change:
https://github.com/haskell/core-libraries-committee/issues/385
Some (small) compilations get faster because they only need to
load (small) interface file GHC.Internal.Classes.IP.hi,
rather than (large) GHC.Internal.Classes.hi.
Metric Decrease:
T10421
T12150
T12425
T24582
T5837
T5030
- - - - -
1e7496ae by Cheng Shao at 2026-01-21T00:23:00-05:00
testsuite: avoid re.sub in favor of simple string replacements
This patch refactors the testsuite driver and avoids the usage of
re.sub in favor of simple string replacements when possible. The
changes are not comprehensive, and there are still a lot of re.sub
usages lingering around the tree, but this already addresses a major
performance bottleneck in the testsuite driver that might has to do
with quadratic or worse slowdown in cpython's regular expression
engine when handling certain regex patterns with large strings.
Especially on i386, and i386 jobs are the bottlenecks of all full-ci
validate pipelines!
Here are the elapsed times of testing x86_64/i386 with -j48 before
this patch:
x86_64: `Build completed in 6m06s`
i386: `Build completed in 1h36m`
And with this patch:
x86_64: `Build completed in 4m55s`
i386: `Build completed in 4m23s`
Fixes #26786.
Co-authored-by: Codex
- - - - -
79e8ef89 by Zubin Duggal at 2026-01-21T00:23:01-05:00
ghc-toolchain: Also configure windres on non-windows platforms.
It may be needed for cross compilation.
Fixes #24588
- - - - -
6ec3f9fb by Cheng Shao at 2026-01-21T00:23:01-05:00
ghci: print external interpreter trace messages to stderr instead of stdout
This patch makes ghci print external interpreter trace messages to
stderr instead of stdout, which is a much saner choice for diagnostic
information. Closes #26807.
- - - - -
29 changed files:
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Unit/State.hs
- compiler/ghc.cabal.in
- docs/users_guide/9.16.1-notes.rst
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Rules/Docspec.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- + libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
- libraries/ghci/GHCi/Server.hs
- rts/include/Cmm.h
- rts/include/stg/Ticky.h
- rts/sm/Storage.c
- testsuite/driver/runtests.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/th/TH_implicitParams.stdout
- + testsuite/tests/typecheck/should_compile/T26737.hs
- testsuite/tests/typecheck/should_compile/all.T
- utils/ghc-toolchain/exe/Main.hs
Changes:
=====================================
compiler/GHC/Builtin/Names.hs
=====================================
@@ -526,7 +526,7 @@ genericTyConNames = [
gHC_PRIM, gHC_PRIM_PANIC,
gHC_TYPES, gHC_INTERNAL_DATA_DATA, gHC_MAGIC, gHC_MAGIC_DICT,
- gHC_CLASSES, gHC_PRIMOPWRAPPERS :: Module
+ gHC_CLASSES, gHC_CLASSES_IP, gHC_PRIMOPWRAPPERS :: Module
gHC_PRIM = mkGhcInternalModule (fsLit "GHC.Internal.Prim") -- Primitive types and values
gHC_PRIM_PANIC = mkGhcInternalModule (fsLit "GHC.Internal.Prim.Panic")
gHC_TYPES = mkGhcInternalModule (fsLit "GHC.Internal.Types")
@@ -534,6 +534,7 @@ gHC_MAGIC = mkGhcInternalModule (fsLit "GHC.Internal.Magic")
gHC_MAGIC_DICT = mkGhcInternalModule (fsLit "GHC.Internal.Magic.Dict")
gHC_CSTRING = mkGhcInternalModule (fsLit "GHC.Internal.CString")
gHC_CLASSES = mkGhcInternalModule (fsLit "GHC.Internal.Classes")
+gHC_CLASSES_IP = mkGhcInternalModule (fsLit "GHC.Internal.Classes.IP")
gHC_PRIMOPWRAPPERS = mkGhcInternalModule (fsLit "GHC.Internal.PrimopWrappers")
gHC_INTERNAL_TUPLE = mkGhcInternalModule (fsLit "GHC.Internal.Tuple")
@@ -1521,7 +1522,7 @@ fromLabelClassOpName
-- Implicit Parameters
ipClassName :: Name
ipClassName
- = clsQual gHC_CLASSES (fsLit "IP") ipClassKey
+ = clsQual gHC_CLASSES_IP (fsLit "IP") ipClassKey
-- Overloaded record fields
hasFieldClassName :: Name
=====================================
compiler/GHC/Unit/State.hs
=====================================
@@ -215,7 +215,7 @@ instance Outputable ModuleOrigin where
(if null rhs
then []
else [text "hidden reexport by" <+>
- sep (map (ppr . mkUnit) res)]) ++
+ sep (map (ppr . mkUnit) rhs)]) ++
(if f then [text "package flag"] else [])
))
=====================================
compiler/ghc.cabal.in
=====================================
@@ -149,6 +149,7 @@ Library
else
Build-Depends: unix >= 2.7 && < 2.9
+ -- Hadrian further set some warnings in its Settings.Warnings module.
GHC-Options: -Wall
-Wno-name-shadowing
-Wnoncanonical-monad-instances
=====================================
docs/users_guide/9.16.1-notes.rst
=====================================
@@ -30,6 +30,18 @@ Language
- The extension :extension:`ExplicitNamespaces` now allows namespace-specified
wildcards ``type ..`` and ``data ..`` in import and export lists.
+- Implicit parameters and ``ImpredicativeTypes``. GHC now knows
+ that if ``?foo::S`` is coecible to ``?foo::T`` only if ``S`` is coercible to ``T``.
+ Example (from :ghc-ticket:`#26737`)::
+
+ {-# LANGUAGE ImplicitParams, ImpredicativeTypes #-}
+ newtype N = MkN Int
+ test :: ((?foo::N) => Bool) -> ((?foo::Int) => Bool)
+ test = coerce
+
+ This is achieved by arranging that ``?foo :: T`` has a representational
+ role for ``T``.
+
Compiler
~~~~~~~~
=====================================
hadrian/src/Hadrian/Utilities.hs
=====================================
@@ -19,7 +19,6 @@ module Hadrian.Utilities (
copyFile, copyFileUntracked, createFileLink, fixFile,
makeExecutable, moveFile, removeFile, createDirectory, copyDirectory,
moveDirectory, removeDirectory, removeFile_, writeFileChangedBS,
- findExecutable,
-- * Diagnostic info
Colour (..), ANSIColour (..), putColoured, shouldUseColor,
@@ -691,7 +690,3 @@ renderUnicorn ls =
ponyPadding = " "
boxLines :: [String]
boxLines = ["", "", ""] ++ (lines . renderBox $ ls)
-
--- Workaround for https://github.com/haskell/directory/issues/180
-findExecutable :: String -> IO (Maybe FilePath)
-findExecutable exe = IO.catch (IO.findExecutable exe) $ \(_ :: IO.IOException) -> pure Nothing
=====================================
hadrian/src/Rules/Docspec.hs
=====================================
@@ -2,6 +2,8 @@ module Rules.Docspec
( docspecRules
) where
+import System.Directory (findExecutable)
+
import Base
import Context.Path
import Settings.Builders.Common
=====================================
hadrian/src/Rules/Lint.hs
=====================================
@@ -4,6 +4,7 @@ module Rules.Lint
import Base
import Settings.Builders.Common
+import System.Directory (findExecutable)
import System.Exit (exitFailure)
lintRules :: Rules ()
=====================================
hadrian/src/Settings/Builders/Ghc.hs
=====================================
@@ -38,7 +38,6 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
stage <- getStage
hie_path <- getHieBuildPath
mconcat [ arg "-Wall"
- , arg "-Wcompat"
, not useColor ? builder (Ghc CompileHs) ?
-- N.B. Target.trackArgument ignores this argument from the
-- input hash to avoid superfluous recompilation, avoiding
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -16,6 +16,7 @@ import Settings.Builders.Common
import qualified Data.Set as Set
import Flavour
import qualified Context.Type as C
+import System.Directory (findExecutable)
import Settings.Program
import qualified Context.Type
=====================================
libraries/ghc-internal/ghc-internal.cabal.in
=====================================
@@ -343,6 +343,7 @@ Library
GHC.Internal.CString
GHC.Internal.Classes
+ GHC.Internal.Classes.IP
GHC.Internal.Debug
GHC.Internal.Magic
GHC.Internal.Magic.Dict
=====================================
libraries/ghc-internal/src/GHC/Internal/Classes.hs
=====================================
@@ -1,10 +1,9 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
KindSignatures, DataKinds, ConstraintKinds,
- MultiParamTypeClasses, FunctionalDependencies #-}
-{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE AllowAmbiguousTypes #-}
- -- ip :: IP x a => a is strictly speaking ambiguous, but IP is magic
+ MultiParamTypeClasses, FunctionalDependencies,
+ UnboxedTuples #-}
+
{-# LANGUAGE UndecidableSuperClasses #-}
-- Because of the type-variable superclasses for tuples
@@ -142,6 +141,7 @@ import GHC.Internal.Prim
import GHC.Internal.Tuple
import GHC.Internal.CString (unpackCString#)
import GHC.Internal.Types
+import GHC.Internal.Classes.IP
infix 4 ==, /=, <, <=, >=, >
infixr 3 &&
@@ -149,12 +149,6 @@ infixr 2 ||
default () -- Double isn't available yet
--- | The syntax @?x :: a@ is desugared into @IP "x" a@
--- IP is declared very early, so that libraries can take
--- advantage of the implicit-call-stack feature
-class IP (x :: Symbol) a | x -> a where
- ip :: a
-
{- $matching_overloaded_methods_in_rules
Matching on class methods (e.g. @(==)@) in rewrite rules tends to be a bit
=====================================
libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
=====================================
@@ -0,0 +1,87 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
+ KindSignatures, DataKinds, ConstraintKinds,
+ MultiParamTypeClasses, FunctionalDependencies #-}
+
+{-# LANGUAGE AllowAmbiguousTypes, RoleAnnotations, IncoherentInstances #-}
+ -- LANGUAGE pragmas: see Note [IP: implicit parameter class]
+
+{-# OPTIONS_HADDOCK not-home #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module : GHC.Internal.Classes.IP
+-- Copyright : (c) The University of Glasgow, 1992-2002
+-- License : see libraries/base/LICENSE
+--
+-- Maintainer : ghc-devs@haskell.org
+-- Stability : internal
+-- Portability : non-portable (GHC extensions)
+--
+-- Basic classes.
+-- Do not import this module directly. It is an GHC internal only
+-- module. Some of its contents are instead available from @Prelude@
+-- and @GHC.Int@.
+--
+-----------------------------------------------------------------------------
+
+module GHC.Internal.Classes.IP( IP(..)) where
+
+import GHC.Internal.Types
+
+
+default () -- Double isn't available yet
+
+-- | The syntax @?x :: a@ is desugared into @IP "x" a@
+-- IP is declared very early, so that libraries can take
+-- advantage of the implicit-call-stack feature
+type role IP nominal representational -- See (IPRoles)
+class IP (x :: Symbol) a | x -> a where
+ ip :: a
+
+{- Note [IP: implicit parameter class]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+An implicit parameter constraint (?foo::ty) is just short for
+
+ IP "foo" ty
+
+where ghc-internal:GHC.Internal.Classes.IP is a special class that
+GHC knows about, defined in this module.
+
+* It is a unary type class, with one method `ip`, so it has no cost.
+ For example, (?foo::Int) is represented just by an Int.
+
+* Criticially, it has a functional dependency:
+ class IP (x :: Symbol) a | x -> a where ...
+ So if we have
+ [G] IP "foo" Int
+ [W] IP "foo" alpha
+ the fundep wil lgive us alpha ~ Int, as desired.
+
+* The solver has a number of special cases for implicit parameters,
+ mainly because a binding (let ?foo::Int = rhs in body)
+ is like a local instance declaration for IP. Search for uses
+ of `isIPClass`.
+
+Wrinkles
+
+(IPAmbiguity) The single method of IP has an ambiguous type
+ ip :: forall a. IP s a => a
+ Hence the LANGUAGE pragama AllowAmbiguousTypes.
+ The method `ip` is never called by the user, so ambiguity doesn't matter.
+
+(IPRoles) IP has a role annotation. Why? See #26737. We want
+ [W] IP "foo" t1 ~R# IP "foo" t2
+ to decompose to give [W] IP t1 ~R# t2, using /representational/
+ equality for (t1 ~R# t2) not nominal.
+
+ This usually gives a complaint about incoherence, because in general
+ (t1 ~R# t2) does NOT imply (C t1) ~R# (C t2) for any normal class.
+ But it does for IP, because instance selection is controlled by the Symbol,
+ not the type of the payload. Hence LANGUAGE pragma IncoherentInstances.
+ (It is unfortunate that we need a module-wide IncoherentInstances here;
+ see #17167.)
+
+ Side note: arguably this treatment could be applied to any class
+ with a functional dependency; but for now we restrict it to IP.
+-}
+
=====================================
libraries/ghci/GHCi/Server.hs
=====================================
@@ -32,11 +32,12 @@ import Data.Binary
import Text.Printf
import System.Environment (getProgName, getArgs)
import System.Exit
+import System.IO
type MessageHook = Msg -> IO Msg
trace :: String -> IO ()
-trace s = getProgName >>= \name -> printf "[%20s] %s\n" name s
+trace s = getProgName >>= \name -> hPrintf stderr "[%20s] %s\n" name s
serv :: Bool -> MessageHook -> Pipe -> (forall a .IO a -> IO a) -> IO ()
serv verbose hook pipe restore = loop
=====================================
rts/include/Cmm.h
=====================================
@@ -441,12 +441,6 @@
#define HP_CHK_P(bytes, fun, arg) \
HEAP_CHECK(bytes, GC_PRIM_P(fun,arg))
-// TODO I'm not seeing where ALLOC_P_TICKY is used; can it be removed?
-// -NSF March 2013
-#define ALLOC_P_TICKY(bytes, fun, arg) \
- HP_CHK_P(bytes); \
- TICK_ALLOC_RTS(bytes);
-
// Load a field out of structure with relaxed ordering.
#define RELAXED_LOAD_FIELD(fld, ptr) \
REP_##fld![(ptr) + OFFSET_##fld]
=====================================
rts/include/stg/Ticky.h
=====================================
@@ -246,7 +246,7 @@ EXTERN StgInt RET_UNBOXED_TUP_hst[TICKY_BIN_COUNT] INIT({0});
TICK_BUMP_BY(ALLOC_THK_gds,g);\
TICK_BUMP_BY(ALLOC_THK_slp,s);\
-#define TICK_ALLOC_RTS(bytes)\
+#define TICK_ALLOC_RTS(n)\
TICK_BUMP(ALLOC_RTS_ctr);\
TICK_BUMP_BY(ALLOC_RTS_tot,n);
#endif
=====================================
rts/sm/Storage.c
=====================================
@@ -990,7 +990,7 @@ move_STACK (StgStack *src, StgStack *dest)
void
accountAllocation(Capability *cap, W_ n)
{
- TICK_ALLOC_RTS(WDS(n));
+ TICK_ALLOC_RTS(n*sizeof(W_));
CCS_ALLOC(cap->r.rCCCS,n);
if (cap->r.rCurrentTSO != NULL) {
// cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_)
=====================================
testsuite/driver/runtests.py
=====================================
@@ -28,7 +28,7 @@ import subprocess
import asyncio
-from testutil import getStdout, str_warn, str_info, print_table, shorten_metric_name
+from testutil import getStdout, str_warn, str_info, print_table, shorten_metric_name, str_removeprefix
from testglobals import getConfig, ghc_env, TestConfig, t, \
TestOptions, brokens, PerfMetric
from my_typing import TestName
@@ -291,7 +291,7 @@ if windows:
for line in pkginfo.split('\n'):
if line.startswith('library-dirs:'):
path = line.rstrip()
- path = re.sub('^library-dirs: ', '', path)
+ path = str_removeprefix(path, 'library-dirs: ')
# Use string.replace instead of re.sub, because re.sub
# interprets backslashes in the replacement string as
# escape sequences.
=====================================
testsuite/driver/testlib.py
=====================================
@@ -25,7 +25,7 @@ from testglobals import config, ghc_env, default_testopts, brokens, t, \
from testutil import strip_quotes, lndir, link_or_copy_file, passed, \
failBecause, testing_metrics, residency_testing_metrics, \
stable_perf_counters, \
- PassFail, badResult, memoize
+ PassFail, badResult, memoize, str_removeprefix
from term_color import Color, colored
import testutil
from cpu_features import have_cpu_feature
@@ -1792,7 +1792,7 @@ async def do_test(name: TestName,
if opts.expect not in ['pass', 'fail', 'missing-lib']:
framework_fail(name, way, 'bad expected ' + opts.expect)
- directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
+ directory = str_removeprefix(str_removeprefix(str(opts.testdir), './'), '.\\')
if way in opts.fragile_ways:
if_verbose(1, '*** fragile test %s resulted in %s' % (full_name, 'pass' if result.passed else 'fail'))
@@ -1830,7 +1830,7 @@ async def do_test(name: TestName,
# if found and instead have the testsuite decide on what to do
# with the output.
def override_options(pre_cmd):
- if config.verbose >= 5 and bool(re.match(r'\$make', pre_cmd, re.I)):
+ if config.verbose >= 5 and pre_cmd.lower().startswith('$make'):
return pre_cmd.replace(' -s' , '') \
.replace('--silent', '') \
.replace('--quiet' , '')
@@ -1843,7 +1843,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str
# so we need to take care not to blow up with the wrong way
# and report the actual reason for the failure.
try:
- directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
+ directory = str_removeprefix(str_removeprefix(str(opts.testdir), './'), '.\\')
except:
directory = ''
full_name = '%s(%s)' % (name, way)
@@ -1856,7 +1856,7 @@ def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str
def framework_warn(name: TestName, way: WayName, reason: str) -> None:
opts = getTestOpts()
- directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
+ directory = str_removeprefix(str_removeprefix(str(opts.testdir), './'), '.\\')
full_name = name + '(' + way + ')'
if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason))
t.framework_warnings.append(TestResult(directory, name, reason, way))
@@ -2550,7 +2550,7 @@ def split_file(in_fn: Path, delimiter: str, out1_fn: Path, out2_fn: Path):
with out1_fn.open('w', encoding='utf8', newline='') as out1:
with out2_fn.open('w', encoding='utf8', newline='') as out2:
line = infile.readline()
- while re.sub(r'^\s*','',line) != delimiter and line != '':
+ while line.lstrip() != delimiter and line != '':
out1.write(line)
line = infile.readline()
@@ -2933,6 +2933,14 @@ def normalise_callstacks(s: str) -> str:
tyCon_re = re.compile(r'TyCon\s*\d+\#\#\d?\d?\s*\d+\#\#\d?\d?\s*', flags=re.MULTILINE)
+def drop_lines_containing(s: str, needle: str) -> str:
+ """
+ Drop lines from `s` which contain `needle`.
+ """
+ if needle not in s:
+ return s
+ return ''.join(line for line in s.splitlines(keepends=True) if needle not in line)
+
def normalise_type_reps(s: str) -> str:
""" Normalise out fingerprints from Typeable TyCon representations """
return re.sub(tyCon_re, 'TyCon FINGERPRINT FINGERPRINT ', s)
@@ -2944,8 +2952,8 @@ def normalise_errmsg(s: str) -> str:
s = s.replace('ld: 0706-027 The -x flag is ignored.\n', '')
# remove " error:" and lower-case " Warning:" to make patch for
# trac issue #10021 smaller
- s = modify_lines(s, lambda l: re.sub(' error:', '', l))
- s = modify_lines(s, lambda l: re.sub(' Warning:', ' warning:', l))
+ s = modify_lines(s, lambda l: l.replace(' error:', ''))
+ s = modify_lines(s, lambda l: l.replace(' Warning:', ' warning:'))
s = normalise_callstacks(s)
s = normalise_type_reps(s)
@@ -2960,7 +2968,7 @@ def normalise_errmsg(s: str) -> str:
# a target prefix (e.g. `aarch64-linux-gnu-ghc`)
# * On Windows the executable name may mention the
# versioned name (e.g. `ghc-9.2.1`)
- s = re.sub(Path(config.compiler).name + ':', 'ghc:', s)
+ s = s.replace(Path(config.compiler).name + ':', 'ghc:')
# If somefile ends in ".exe" or ".exe:", zap ".exe" (for Windows)
# the colon is there because it appears in error messages; this
@@ -2973,11 +2981,13 @@ def normalise_errmsg(s: str) -> str:
s = re.sub(r'([^\s])\.jsexe', r'\1', s)
# hpc executable is given ghc suffix
- s = re.sub('hpc-ghc', 'hpc', s)
+ s = s.replace('hpc-ghc', 'hpc')
# The inplace ghc's are called ghc-stage[123] to avoid filename
# collisions, so we need to normalise that to just "ghc"
- s = re.sub('ghc-stage[123]', 'ghc', s)
+ s = (s.replace('ghc-stage1', 'ghc')
+ .replace('ghc-stage2', 'ghc')
+ .replace('ghc-stage3', 'ghc'))
# Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools
# (ghc, ghc-pkg, unlit, etc.)
s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s)
@@ -3000,7 +3010,7 @@ def normalise_errmsg(s: str) -> str:
# Also filter out bullet characters. This is because bullets are used to
# separate error sections, and tests shouldn't be sensitive to how the
# the division happens.
- bullet = '•'.encode('utf8') if isinstance(s, bytes) else '•'
+ bullet = '•'
s = s.replace(bullet, '')
# Windows only, this is a bug in hsc2hs but it is preventing
@@ -3015,19 +3025,19 @@ def normalise_errmsg(s: str) -> str:
s = modify_lines(s, lambda l: re.sub(r'^(.+)warning: (.+): unsupported GNU_PROPERTY_TYPE (?:\(5\) )?type: 0xc000000(.*)$', '', l))
s = re.sub(r'ld: warning: passed .* min versions \(.*\) for platform macOS. Using [\.0-9]+.','',s)
- s = re.sub('ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version','',s)
+ s = s.replace('ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version', '')
# ignore superfluous dylibs passed to the linker.
- s = re.sub('ld: warning: .*, ignoring unexpected dylib file\n','',s)
+ s = drop_lines_containing(s, 'ignoring unexpected dylib file')
# ignore LLVM Version mismatch garbage; this will just break tests.
- s = re.sub('You are using an unsupported version of LLVM!.*\n','',s)
- s = re.sub('Currently only [\\.0-9]+ is supported. System LLVM version: [\\.0-9]+.*\n','',s)
- s = re.sub('We will try though\\.\\.\\..*\n','',s)
+ s = drop_lines_containing(s, 'You are using an unsupported version of LLVM!')
+ s = drop_lines_containing(s, 'System LLVM version:')
+ s = drop_lines_containing(s, 'We will try though...')
# ignore warning about strip invalidating signatures
- s = re.sub('.*strip: changes being made to the file will invalidate the code signature in.*\n','',s)
+ s = drop_lines_containing(s, 'strip: changes being made to the file will invalidate the code signature in')
# clang may warn about unused argument when used as assembler
- s = re.sub('.*warning: argument unused during compilation:.*\n', '', s)
+ s = drop_lines_containing(s, 'warning: argument unused during compilation:')
# Emscripten displays cache info and old emcc doesn't support EMCC_LOGGING=0
- s = re.sub('cache:INFO: .*\n', '', s)
+ s = drop_lines_containing(s, 'cache:INFO:')
# Old emcc warns when we export HEAP8 but new one requires it (see #26290)
s = s.replace('warning: invalid item in EXPORTED_RUNTIME_METHODS: HEAP8\nwarning: invalid item in EXPORTED_RUNTIME_METHODS: HEAPU8\nemcc: warning: warnings in JS library compilation [-Wjs-compiler]\n','')
@@ -3050,7 +3060,7 @@ def normalise_prof (s: str) -> str:
# The next step assumes none of the fields have no spaces in, which is broke
# when the src = <no location info>
- s = re.sub('no location info','no-location-info', s)
+ s = s.replace('no location info', 'no-location-info')
# Source locations from internal libraries, remove the source location
# > libraries/ghc-internal/src/path/Foo.hs:204:1-18
@@ -3103,21 +3113,21 @@ def normalise_prof (s: str) -> str:
return s
def normalise_slashes_( s: str ) -> str:
- s = re.sub(r'\\', '/', s)
- s = re.sub(r'//', '/', s)
+ s = s.replace('\\', '/')
+ s = s.replace('//', '/')
return s
def normalise_exe_( s: str ) -> str:
- s = re.sub(r'\.exe', '', s)
- s = re.sub(r'\.wasm', '', s)
- s = re.sub(r'\.jsexe', '', s)
+ s = s.replace('.exe', '')
+ s = s.replace('.wasm', '')
+ s = s.replace('.jsexe', '')
return s
def normalise_output( s: str ) -> str:
# remove " error:" and lower-case " Warning:" to make patch for
# trac issue #10021 smaller
- s = modify_lines(s, lambda l: re.sub(' error:', '', l))
- s = modify_lines(s, lambda l: re.sub(' Warning:', ' warning:', l))
+ s = modify_lines(s, lambda l: l.replace(' error:', ''))
+ s = modify_lines(s, lambda l: l.replace(' Warning:', ' warning:'))
# Remove a .exe extension (for Windows)
# and .wasm extension (for the Wasm backend)
# and .jsexe extension (for the JS backend)
@@ -3129,19 +3139,19 @@ def normalise_output( s: str ) -> str:
s = normalise_type_reps(s)
# ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is
# requires for -fPIC
- s = re.sub(' -fexternal-dynamic-refs\n','',s)
+ s = s.replace(' -fexternal-dynamic-refs\n', '')
s = re.sub(r'ld: warning: passed .* min versions \(.*\) for platform macOS. Using [\.0-9]+.','',s)
- s = re.sub('ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version','',s)
+ s = s.replace('ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version', '')
# ignore superfluous dylibs passed to the linker.
- s = re.sub('ld: warning: .*, ignoring unexpected dylib file\n','',s)
+ s = drop_lines_containing(s, 'ignoring unexpected dylib file')
# ignore LLVM Version mismatch garbage; this will just break tests.
- s = re.sub('You are using an unsupported version of LLVM!.*\n','',s)
- s = re.sub('Currently only [\\.0-9]+ is supported. System LLVM version: [\\.0-9]+.*\n','',s)
- s = re.sub('We will try though\\.\\.\\..*\n','',s)
+ s = drop_lines_containing(s, 'You are using an unsupported version of LLVM!')
+ s = drop_lines_containing(s, 'System LLVM version:')
+ s = drop_lines_containing(s, 'We will try though...')
# ignore warning about strip invalidating signatures
- s = re.sub('.*strip: changes being made to the file will invalidate the code signature in.*\n','',s)
+ s = drop_lines_containing(s, 'strip: changes being made to the file will invalidate the code signature in')
# clang may warn about unused argument when used as assembler
- s = re.sub('.*warning: argument unused during compilation:.*\n', '', s)
+ s = drop_lines_containing(s, 'warning: argument unused during compilation:')
# strip the cross prefix if any
s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s)
=====================================
testsuite/driver/testutil.py
=====================================
@@ -40,6 +40,12 @@ def strip_quotes(s: str) -> str:
# Don't wrap commands to subprocess.call/Popen in quotes.
return s.strip('\'"')
+# Python 3.7 compatibility shim for str.removeprefix (added in Python 3.9).
+def str_removeprefix(s: str, prefix: str) -> str:
+ if s.startswith(prefix):
+ return s.replace(prefix, '', 1)
+ return s
+
def str_warn(s: str) -> str:
return colored(Color.YELLOW, s)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -3293,6 +3293,7 @@ module GHC.Base where
{-# MINIMAL fmap #-}
type IO :: * -> *
newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
+ type role IP nominal representational
type IP :: Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -3293,6 +3293,7 @@ module GHC.Base where
{-# MINIMAL fmap #-}
type IO :: * -> *
newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
+ type role IP nominal representational
type IP :: Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -3293,6 +3293,7 @@ module GHC.Base where
{-# MINIMAL fmap #-}
type IO :: * -> *
newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
+ type role IP nominal representational
type IP :: Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -3293,6 +3293,7 @@ module GHC.Base where
{-# MINIMAL fmap #-}
type IO :: * -> *
newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
+ type role IP nominal representational
type IP :: Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/interface-stability/ghc-prim-exports.stdout
=====================================
@@ -1171,6 +1171,7 @@ module GHC.Classes where
(==) :: a -> a -> GHC.Internal.Types.Bool
(/=) :: a -> a -> GHC.Internal.Types.Bool
{-# MINIMAL (==) | (/=) #-}
+ type role IP nominal representational
type IP :: GHC.Internal.Types.Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
=====================================
@@ -1171,6 +1171,7 @@ module GHC.Classes where
(==) :: a -> a -> GHC.Internal.Types.Bool
(/=) :: a -> a -> GHC.Internal.Types.Bool
{-# MINIMAL (==) | (/=) #-}
+ type role IP nominal representational
type IP :: GHC.Internal.Types.Symbol -> * -> Constraint
class IP x a | x -> a where
ip :: a
=====================================
testsuite/tests/th/TH_implicitParams.stdout
=====================================
@@ -1,5 +1,5 @@
-Main.funcToReify :: GHC.Internal.Classes.IP "z"
- GHC.Internal.Types.Int =>
+Main.funcToReify :: GHC.Internal.Classes.IP.IP "z"
+ GHC.Internal.Types.Int =>
GHC.Internal.Types.Int
5
1
=====================================
testsuite/tests/typecheck/should_compile/T26737.hs
=====================================
@@ -0,0 +1,10 @@
+{-# LANGUAGE ImpredicativeTypes, ImplicitParams #-}
+
+module T26737 where
+
+import Data.Coerce
+
+newtype Foo = MkFoo Int
+
+b :: ((?foo :: Foo) => Int) -> ((?foo :: Int) => Int)
+b = coerce @(((?foo :: Foo) => Int)) @(((?foo :: Int) => Int))
=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -958,3 +958,4 @@ test('T14745', normal, compile, [''])
test('T26451', normal, compile, [''])
test('T26582', normal, compile, [''])
test('T26746', normal, compile, [''])
+test('T26737', normal, compile, [''])
=====================================
utils/ghc-toolchain/exe/Main.hs
=====================================
@@ -480,13 +480,8 @@ mkTarget opts = do
opt <- optional $ findProgram "opt" (optOpt opts) ["opt"]
llvmAs <- optional $ findProgram "llvm assembler" (optLlvmAs opts) ["clang"]
- -- Windows-specific utilities
- windres <-
- case archOS_OS archOs of
- OSMinGW32 -> do
- windres <- findProgram "windres" (optWindres opts) ["windres"]
- return (Just windres)
- _ -> return Nothing
+ -- for windows, also used for cross compiling
+ windres <- optional $ findProgram "windres" (optWindres opts) ["windres"]
-- Darwin-specific utilities
(otool, installNameTool) <-
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/814b833d04b068722b7b1ca71499602...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/814b833d04b068722b7b1ca71499602...
You're receiving this email because of your account on gitlab.haskell.org.