[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: Remove duplicate code normalising slashes
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Mar 12 20:36:04 UTC 2024
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
8a39431d by Brandon Chinn at 2024-03-12T16:35:47-04:00
Remove duplicate code normalising slashes
- - - - -
607b493f by Brandon Chinn at 2024-03-12T16:35:47-04:00
Simplify regexes with raw strings
- - - - -
7aab64a3 by Brandon Chinn at 2024-03-12T16:35:47-04:00
Don't normalize backslashes in characters
- - - - -
56dbd6c9 by Andrei Borzenkov at 2024-03-12T16:35:48-04:00
Fix compiler crash caused by implicit RHS quantification in type synonyms (#24470)
- - - - -
3d6fecd6 by Cheng Shao at 2024-03-12T16:35:50-04:00
Revert "compiler: make genSym use C-based atomic increment on non-JS 32-bit platforms"
This reverts commit 615eb855416ce536e02ed935ecc5a6f25519ae16. It was
originally intended to fix #24449, but it was merely sweeping the bug
under the rug. 3836a110577b5c9343915fd96c1b2c64217e0082 has properly
fixed the fragile test, and we no longer need the C version of genSym.
Furthermore, the C implementation causes trouble when compiling with
clang that targets i386 due to alignment warning and libatomic linking
issue, so it makes sense to revert it.
- - - - -
5a999d85 by Cheng Shao at 2024-03-12T16:35:50-04:00
compiler: fix out-of-bound memory access of genSym on 32-bit
This commit fixes an unnoticed out-of-bound memory access of genSym on
32-bit. ghc_unique_inc is 32-bit sized/aligned on 32-bit platforms,
but we mistakenly treat it as a Word64 pointer in genSym, and
therefore will accidentally load 2 garbage higher bytes, or with a
small but non-zero chance, overwrite something else in the data
section depends on how the linker places the data segments. This
regression was introduced in !11802 and fixed here.
- - - - -
18 changed files:
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Unique/Supply.hs
- compiler/cbits/genSym.c
- testsuite/driver/testlib.py
- testsuite/tests/parser/should_fail/T21843a.stderr
- testsuite/tests/parser/should_fail/T21843b.stderr
- testsuite/tests/parser/should_fail/T21843c.stderr
- testsuite/tests/parser/should_fail/T21843d.stderr
- testsuite/tests/parser/should_fail/T21843e.stderr
- testsuite/tests/parser/should_fail/T21843f.stderr
- + testsuite/tests/typecheck/should_compile/T24470b.hs
- testsuite/tests/typecheck/should_compile/all.T
- + testsuite/tests/typecheck/should_fail/T24470a.hs
- + testsuite/tests/typecheck/should_fail/T24470a.stderr
- testsuite/tests/typecheck/should_fail/all.T
Changes:
=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -1922,6 +1922,18 @@ instance Diagnostic TcRnMessage where
, text "in a fixity signature"
]
+ TcRnOutOfArityTyVar ts_name tv_name -> mkDecorated
+ [ vcat [ text "The arity of" <+> quotes (ppr ts_name) <+> text "is insufficiently high to accommodate"
+ , text "an implicit binding for the" <+> quotes (ppr tv_name) <+> text "type variable." ]
+ , suggestion ]
+ where
+ suggestion =
+ text "Use" <+> quotes at_bndr <+> text "on the LHS" <+>
+ text "or" <+> quotes forall_bndr <+> text "on the RHS" <+>
+ text "to bring it into scope."
+ at_bndr = char '@' <> ppr tv_name
+ forall_bndr = text "forall" <+> ppr tv_name <> text "."
+
diagnosticReason :: TcRnMessage -> DiagnosticReason
diagnosticReason = \case
TcRnUnknownMessage m
@@ -2556,6 +2568,8 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnNamespacedFixitySigWithoutFlag{}
-> ErrorWithoutFlag
+ TcRnOutOfArityTyVar{}
+ -> ErrorWithoutFlag
diagnosticHints = \case
TcRnUnknownMessage m
@@ -3224,6 +3238,8 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnNamespacedFixitySigWithoutFlag{}
-> [suggestExtension LangExt.ExplicitNamespaces]
+ TcRnOutOfArityTyVar{}
+ -> noHints
diagnosticCode = constructorCode
=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -2272,6 +2272,8 @@ data TcRnMessage where
where the implicitly-bound type type variables can't be matched up unambiguously
with the ones from the signature. See Note [Disconnected type variables] in
GHC.Tc.Gen.HsType.
+
+ Test cases: T24083
-}
TcRnDisconnectedTyVar :: !Name -> TcRnMessage
@@ -4267,6 +4269,24 @@ data TcRnMessage where
-}
TcRnDefaultedExceptionContext :: CtLoc -> TcRnMessage
+ {-| TcRnOutOfArityTyVar is an error raised when the arity of a type synonym
+ (as determined by the SAKS and the LHS) is insufficiently high to
+ accommodate an implicit binding for a free variable that occurs in the
+ outermost kind signature on the RHS of the said type synonym.
+
+ Example:
+
+ type SynBad :: forall k. k -> Type
+ type SynBad = Proxy :: j -> Type
+
+ Test cases:
+ T24770a
+ -}
+ TcRnOutOfArityTyVar
+ :: Name -- ^ Type synonym's name
+ -> Name -- ^ Type variable's name
+ -> TcRnMessage
+
deriving Generic
----
=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -2617,7 +2617,7 @@ kcCheckDeclHeader_sig sig_kind name flav
; implicit_tvs <- liftZonkM $ zonkTcTyVarsToTcTyVars implicit_tvs
; let implicit_prs = implicit_nms `zip` implicit_tvs
; checkForDuplicateScopedTyVars implicit_prs
- ; checkForDisconnectedScopedTyVars flav all_tcbs implicit_prs
+ ; checkForDisconnectedScopedTyVars name flav all_tcbs implicit_prs
-- Swizzle the Names so that the TyCon uses the user-declared implicit names
-- E.g type T :: k -> Type
@@ -2978,25 +2978,32 @@ expectedKindInCtxt _ = OpenKind
* *
********************************************************************* -}
-checkForDisconnectedScopedTyVars :: TyConFlavour TyCon -> [TcTyConBinder]
+checkForDisconnectedScopedTyVars :: Name -> TyConFlavour TyCon -> [TcTyConBinder]
-> [(Name,TcTyVar)] -> TcM ()
-- See Note [Disconnected type variables]
+-- For the type synonym case see Note [Out of arity type variables]
-- `scoped_prs` is the mapping gotten by unifying
-- - the standalone kind signature for T, with
-- - the header of the type/class declaration for T
-checkForDisconnectedScopedTyVars flav sig_tcbs scoped_prs
- = when (needsEtaExpansion flav) $
+checkForDisconnectedScopedTyVars name flav all_tcbs scoped_prs
-- needsEtaExpansion: see wrinkle (DTV1) in Note [Disconnected type variables]
- mapM_ report_disconnected (filterOut ok scoped_prs)
+ | needsEtaExpansion flav = mapM_ report_disconnected (filterOut ok scoped_prs)
+ | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs)
+ | otherwise = pure ()
where
- sig_tvs = mkVarSet (binderVars sig_tcbs)
- ok (_, tc_tv) = tc_tv `elemVarSet` sig_tvs
+ all_tvs = mkVarSet (binderVars all_tcbs)
+ ok (_, tc_tv) = tc_tv `elemVarSet` all_tvs
report_disconnected :: (Name,TcTyVar) -> TcM ()
report_disconnected (nm, _)
= setSrcSpan (getSrcSpan nm) $
addErrTc $ TcRnDisconnectedTyVar nm
+ report_out_of_arity :: (Name,TcTyVar) -> TcM ()
+ report_out_of_arity (tv_nm, _)
+ = setSrcSpan (getSrcSpan tv_nm) $
+ addErrTc $ TcRnOutOfArityTyVar name tv_nm
+
checkForDuplicateScopedTyVars :: [(Name,TcTyVar)] -> TcM ()
-- Check for duplicates
-- E.g. data SameKind (a::k) (b::k)
@@ -3083,6 +3090,63 @@ explicitly, rather than binding it implicitly via unification.
The scoped-tyvar stuff is needed precisely for data/class/newtype declarations,
where needsEtaExpansion is True.
+
+Note [Out of arity type variables]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+(Relevant ticket: #24470)
+Type synonyms have a special scoping rule that allows implicit quantification in
+the outermost kind signature:
+
+ type P_e :: k -> Type
+ type P_e @k = Proxy :: k -> Type -- explicit binding
+
+ type P_i = Proxy :: k -> Type -- implicit binding (relies on the special rule)
+
+This is a deprecated feature (warning flag: -Wimplicit-rhs-quantification) but
+we have to support it for a couple more releases. It is explained in more detail
+in Note [Implicit quantification in type synonyms] in GHC.Rename.HsType.
+
+Type synonyms `P_e` and `P_i` are equivalent. Both of them have kind
+`forall k. k -> Type` and arity 1. (Recall that the arity of a type synonym is
+the number of arguments it requires at use sites; the arity matter because
+unsaturated application of type families and type synonyms is not allowed).
+
+We start to see problems when implicit RHS quantification (as in `P_i`) is
+combined with a standalone king signature (like the one that `P_e` has).
+That is:
+
+ type P_i_sig :: k -> Type
+ type P_i_sig = Proxy :: k -> Type
+
+Per GHC Proposal #425, the arity of `P_i_sig` is determined /by the LHS only/,
+which has no binders. So the arity of `P_i_sig` is 0.
+At the same time, the legacy implicit quantification rule dictates that `k` is
+brought into scope, as if there was a binder `@k` on the LHS.
+
+We end up with a `k` that is in scope on the RHS but cannot be bound implicitly
+on the LHS without affecting the arity. This led to #24470 (a compiler crash)
+
+ GHC internal error: ‘k’ is not in scope during type checking,
+ but it passed the renamer
+
+This problem occurs only if the arity of the type synonym is insufficiently
+high to accommodate an implicit binding. It can be worked around by adding an
+unused binder on the LHS:
+
+ type P_w :: k -> Type
+ type P_w @_w = Proxy :: k -> Type
+
+The variable `_w` is unused. The only effect of the `@_w` binder is that the
+arity of `P_w` is changed from 0 to 1. However, bumping the arity is exactly
+what's needed to make the implicit binding of `k` possible.
+
+All this is a rather unfortunate bit of accidental complexity that will go away
+when GHC drops support for implicit RHS quantification. In the meantime, we
+ought to produce a proper error message instead of a compiler panic, and we do
+that with a check in checkForDisconnectedScopedTyVars:
+
+ | flav == TypeSynonymFlavour = mapM_ report_out_of_arity (filterOut ok scoped_prs)
+
-}
{- *********************************************************************
=====================================
compiler/GHC/Types/Error/Codes.hs
=====================================
@@ -606,6 +606,7 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "TcRnInvisPatWithNoForAll" = 14964
GhcDiagnosticCode "TcRnIllegalInvisibleTypePattern" = 78249
GhcDiagnosticCode "TcRnNamespacedFixitySigWithoutFlag" = 78534
+ GhcDiagnosticCode "TcRnOutOfArityTyVar" = 84925
-- TcRnTypeApplicationsDisabled
GhcDiagnosticCode "TypeApplication" = 23482
=====================================
compiler/GHC/Types/Unique/Supply.hs
=====================================
@@ -7,7 +7,6 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE UnliftedFFITypes #-}
module GHC.Types.Unique.Supply (
-- * Main data type
@@ -49,16 +48,16 @@ import Foreign.Storable
#define NO_FETCH_ADD
#endif
-#if defined(javascript_HOST_ARCH)
-import GHC.Exts ( atomicCasWord64Addr#, eqWord64# )
-#elif !defined(NO_FETCH_ADD)
-import GHC.Exts( fetchAddWordAddr#, word64ToWord#, wordToWord64# )
+#if defined(NO_FETCH_ADD)
+import GHC.Exts ( atomicCasWord64Addr#, eqWord64#, readWord64OffAddr# )
+#else
+import GHC.Exts( fetchAddWordAddr#, word64ToWord# )
#endif
import GHC.Exts ( Addr#, State#, Word64#, RealWorld )
-
+import GHC.Int ( Int(..) )
import GHC.Word( Word64(..) )
-import GHC.Exts( plusWord64#, readWord64OffAddr# )
+import GHC.Exts( plusWord64#, int2Word#, wordToWord64# )
{-
************************************************************************
@@ -233,8 +232,9 @@ mkSplitUniqSupply c
(# s4, MkSplitUniqSupply (tag .|. u) x y #)
}}}}
-#if defined(javascript_HOST_ARCH)
--- CAS-based pure Haskell implementation
+#if defined(NO_FETCH_ADD)
+-- GHC currently does not provide this operation on 32-bit platforms,
+-- hence the CAS-based implementation.
fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld
-> (# State# RealWorld, Word64# #)
fetchAddWord64Addr# = go
@@ -246,35 +246,7 @@ fetchAddWord64Addr# = go
(# s2, res #)
| 1# <- res `eqWord64#` n0 -> (# s2, n0 #)
| otherwise -> go ptr inc s2
-
-#elif defined(NO_FETCH_ADD)
-
--- atomic_inc64 is defined in compiler/cbits/genSym.c. This is of
--- course not ideal, but we need to live with it for now given the
--- current situation:
--- 1. There's no Haskell primop fetchAddWord64Addr# on 32-bit
--- platforms yet
--- 2. The Cmm %fetch_add64 primop syntax is only present in ghc 9.8
--- but we currently bootstrap from older ghc in our CI
--- 3. The Cmm MO_AtomicRMW operation with 64-bit width is well
--- supported on 32-bit platforms already, but the plumbing from
--- either Haskell or Cmm doesn't work yet because of 1 or 2
--- 4. There's hs_atomic_add64 in ghc-prim cbits that we ought to use,
--- but it's only available on 32-bit starting from ghc 9.8
--- 5. The pure Haskell implementation causes mysterious i386
--- regression in unrelated ghc work that can only be fixed by the C
--- version here
-
-foreign import ccall unsafe "atomic_inc64" atomic_inc64 :: Addr# -> Word64# -> IO Word64
-
-fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld
- -> (# State# RealWorld, Word64# #)
-fetchAddWord64Addr# addr inc s0 =
- case unIO (atomic_inc64 addr inc) s0 of
- (# s1, W64# res #) -> (# s1, res #)
-
#else
-
fetchAddWord64Addr# :: Addr# -> Word64# -> State# RealWorld
-> (# State# RealWorld, Word64# #)
fetchAddWord64Addr# addr inc s0 =
@@ -286,9 +258,9 @@ genSym :: IO Word64
genSym = do
let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1
let !(Ptr counter) = ghc_unique_counter64
- let !(Ptr inc_ptr) = ghc_unique_inc
- u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of
- (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of
+ I# inc# <- peek ghc_unique_inc
+ let !inc = wordToWord64# (int2Word# inc#)
+ u <- IO $ \s1 -> case fetchAddWord64Addr# counter inc s1 of
(# s2, val #) ->
let !u = W64# (val `plusWord64#` inc) .&. mask
in (# s2, u #)
=====================================
compiler/cbits/genSym.c
=====================================
@@ -15,11 +15,3 @@ HsWord64 ghc_unique_counter64 = 0;
#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0)
HsInt ghc_unique_inc = 1;
#endif
-
-// Only used on 32-bit non-JS platforms
-#if WORD_SIZE_IN_BITS != 64
-StgWord64 atomic_inc64(StgWord64 volatile* p, StgWord64 incr)
-{
- return __atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST);
-}
-#endif
=====================================
testsuite/driver/testlib.py
=====================================
@@ -1119,8 +1119,8 @@ def normalise_win32_io_errors(name, opts):
def normalise_version_( *pkgs ):
def normalise_version__( str ):
# (name)(-version)(-hash)(-components)
- return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+(-[0-9a-zA-Z\+]+)?(-[0-9a-zA-Z]+)?',
- '\\1-<VERSION>-<HASH>', str)
+ return re.sub('(' + '|'.join(map(re.escape,pkgs)) + r')-[0-9.]+(-[0-9a-zA-Z+]+)?(-[0-9a-zA-Z]+)?',
+ r'\1-<VERSION>-<HASH>', str)
return normalise_version__
def normalise_version( *pkgs ):
@@ -1491,7 +1491,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('^\\.[/\\\\]', '', str(opts.testdir))
+ directory = re.sub(r'^\.[/\\]', '', 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'))
@@ -1538,7 +1538,7 @@ def override_options(pre_cmd):
def framework_fail(name: Optional[TestName], way: Optional[WayName], reason: str) -> None:
opts = getTestOpts()
- directory = re.sub('^\\.[/\\\\]', '', str(opts.testdir))
+ directory = re.sub(r'^\.[/\\]', '', str(opts.testdir))
full_name = '%s(%s)' % (name, way)
if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason))
name2 = name if name is not None else TestName('none')
@@ -1549,7 +1549,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('^\\.[/\\\\]', '', str(opts.testdir))
+ directory = re.sub(r'^\.[/\\]', '', 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))
@@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str:
s = normalise_callstacks(s)
s = normalise_type_reps(s)
- # normalise slashes, minimise Windows/Unix filename differences
- s = re.sub('\\\\', '/', s)
+ # normalise slashes to minimise Windows/Unix filename differences,
+ # but don't normalize backslashes in chars
+ s = re.sub(r"(?!')\\", '/', s)
# Normalize the name of the GHC executable. Specifically,
# this catches the cases that:
@@ -2614,14 +2615,11 @@ def normalise_errmsg(s: str) -> str:
# the colon is there because it appears in error messages; this
# hacky solution is used in place of more sophisticated filename
# mangling
- s = re.sub('([^\\s])\\.exe', '\\1', s)
+ s = re.sub(r'([^\s])\.exe', r'\1', s)
# Same thing for .wasm modules generated by the Wasm backend
- s = re.sub('([^\\s])\\.wasm', '\\1', s)
+ s = re.sub(r'([^\s])\.wasm', r'\1', s)
# Same thing for .jsexe directories generated by the JS backend
- s = re.sub('([^\\s])\\.jsexe', '\\1', s)
-
- # normalise slashes, minimise Windows/Unix filename differences
- s = re.sub('\\\\', '/', s)
+ s = re.sub(r'([^\s])\.jsexe', r'\1', s)
# hpc executable is given ghc suffix
s = re.sub('hpc-ghc', 'hpc', s)
@@ -2631,8 +2629,8 @@ def normalise_errmsg(s: str) -> str:
s = re.sub('ghc-stage[123]', 'ghc', s)
# Remove platform prefix (e.g. javascript-unknown-ghcjs) for cross-compiled tools
# (ghc, ghc-pkg, unlit, etc.)
- s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s)
- s = re.sub('\\w+(-\\w+)*-unlit', 'unlit', s)
+ s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s)
+ s = re.sub(r'\w+(-\w+)*-unlit', 'unlit', s)
# On windows error messages can mention versioned executables
s = re.sub('ghc-[0-9.]+', 'ghc', s)
@@ -2735,8 +2733,8 @@ def normalise_prof (s: str) -> str:
return s
def normalise_slashes_( s: str ) -> str:
- s = re.sub('\\\\', '/', s)
- s = re.sub('//', '/', s)
+ s = re.sub(r'\\', '/', s)
+ s = re.sub(r'//', '/', s)
return s
def normalise_exe_( s: str ) -> str:
@@ -2754,9 +2752,9 @@ def normalise_output( s: str ) -> str:
# and .wasm extension (for the Wasm backend)
# and .jsexe extension (for the JS backend)
# This can occur in error messages generated by the program.
- s = re.sub('([^\\s])\\.exe', '\\1', s)
- s = re.sub('([^\\s])\\.wasm', '\\1', s)
- s = re.sub('([^\\s])\\.jsexe', '\\1', s)
+ s = re.sub(r'([^\s])\.exe', r'\1', s)
+ s = re.sub(r'([^\s])\.wasm', r'\1', s)
+ s = re.sub(r'([^\s])\.jsexe', r'\1', s)
s = normalise_callstacks(s)
s = normalise_type_reps(s)
# ghci outputs are pretty unstable with -fexternal-dynamic-refs, which is
@@ -2776,7 +2774,7 @@ def normalise_output( s: str ) -> str:
s = re.sub('.*warning: argument unused during compilation:.*\n', '', s)
# strip the cross prefix if any
- s = re.sub('\\w+(-\\w+)*-ghc', 'ghc', s)
+ s = re.sub(r'\w+(-\w+)*-ghc', 'ghc', s)
return s
=====================================
testsuite/tests/parser/should_fail/T21843a.stderr
=====================================
@@ -1,4 +1,4 @@
T21843a.hs:3:13: [GHC-31623]
- Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not
+ Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not
=====================================
testsuite/tests/parser/should_fail/T21843b.stderr
=====================================
@@ -1,3 +1,3 @@
T21843b.hs:3:11: [GHC-31623]
- Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not
+ Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not
=====================================
testsuite/tests/parser/should_fail/T21843c.stderr
=====================================
@@ -1,6 +1,6 @@
T21843c.hs:3:19: [GHC-31623]
- Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not
+ Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not
T21843c.hs:3:20: [GHC-21231]
- lexical error in string/character literal at character '/n'
+ lexical error in string/character literal at character '\n'
=====================================
testsuite/tests/parser/should_fail/T21843d.stderr
=====================================
@@ -1,3 +1,3 @@
T21843d.hs:3:13: [GHC-31623]
- Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not
+ Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not
=====================================
testsuite/tests/parser/should_fail/T21843e.stderr
=====================================
@@ -1,3 +1,3 @@
T21843e.hs:3:15: [GHC-31623]
- Unicode character '”' ('/8221') looks like '"' (Quotation Mark), but it is not
+ Unicode character '”' ('\8221') looks like '"' (Quotation Mark), but it is not
=====================================
testsuite/tests/parser/should_fail/T21843f.stderr
=====================================
@@ -1,3 +1,3 @@
T21843f.hs:3:13: [GHC-31623]
- Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not
+ Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not
=====================================
testsuite/tests/typecheck/should_compile/T24470b.hs
=====================================
@@ -0,0 +1,10 @@
+{-# OPTIONS_GHC -Wno-implicit-rhs-quantification #-}
+{-# LANGUAGE TypeAbstractions #-}
+
+module T24470b where
+
+import Data.Kind
+import Data.Data
+
+type SynOK :: forall k. k -> Type
+type SynOK @t = Proxy :: j -> Type
=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -912,3 +912,4 @@ test('T21206', normal, compile, [''])
test('T17594a', req_th, compile, [''])
test('T17594f', normal, compile, [''])
test('WarnDefaultedExceptionContext', normal, compile, ['-Wdefaulted-exception-context'])
+test('T24470b', normal, compile, [''])
=====================================
testsuite/tests/typecheck/should_fail/T24470a.hs
=====================================
@@ -0,0 +1,7 @@
+module T24470a where
+
+import Data.Data
+import Data.Kind
+
+type SynBad :: forall k. k -> Type
+type SynBad = Proxy :: j -> Type
=====================================
testsuite/tests/typecheck/should_fail/T24470a.stderr
=====================================
@@ -0,0 +1,6 @@
+
+T24470a.hs:7:24: error: [GHC-84925]
+ • The arity of ‘SynBad’ is insufficiently high to accommodate
+ an implicit binding for the ‘j’ type variable.
+ • Use ‘@j’ on the LHS or ‘forall j.’ on the RHS to bring it into scope.
+ • In the type synonym declaration for ‘SynBad’
=====================================
testsuite/tests/typecheck/should_fail/all.T
=====================================
@@ -722,3 +722,5 @@ test('DoExpansion3', normal, compile, ['-fdefer-type-errors'])
test('T17594c', normal, compile_fail, [''])
test('T17594d', normal, compile_fail, [''])
test('T17594g', normal, compile_fail, [''])
+
+test('T24470a', normal, compile_fail, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/83d82da64b304381e856bb43e2d453501ca9d908...5a999d85560752ad7d66159a70ef1b9e7cff4c41
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/83d82da64b304381e856bb43e2d453501ca9d908...5a999d85560752ad7d66159a70ef1b9e7cff4c41
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/20240312/b3905ec0/attachment-0001.html>
More information about the ghc-commits
mailing list