Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
b388d093
by Brian McKenna at 2026-07-18T17:51:50-04:00
-
c23e1acb
by Mrjtjmn at 2026-07-18T17:52:45-04:00
-
3d51b87e
by Artem Pelenitsyn at 2026-07-19T04:39:33-04:00
-
622b50f4
by Duncan Coutts at 2026-07-19T04:39:34-04:00
17 changed files:
- + changelog.d/T26532
- + changelog.d/T27314.md
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock.hs
- rts/sm/NonMovingMark.c
- + testsuite/tests/pmcheck/should_compile/T27314.hs
- testsuite/tests/pmcheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T15067.stderr
- + testsuite/tests/typecheck/should_fail/T26532.hs
- + testsuite/tests/typecheck/should_fail/T26532.stderr
- testsuite/tests/typecheck/should_fail/T9858b.stderr
- testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr
- testsuite/tests/typecheck/should_fail/all.T
Changes:
| 1 | +section: compiler
|
|
| 2 | +issues: #26532
|
|
| 3 | +mrs: !16351
|
|
| 4 | +synopsis:
|
|
| 5 | + Add explanations for unsolved Typeable constraints
|
|
| 6 | +description:
|
|
| 7 | + GHC now provides additional explanations for an unsolved constraint of the
|
|
| 8 | + form ``Typeable ty``, explain why GHC did not solve ``Typeable`` constraint. |
| 1 | +section: compiler
|
|
| 2 | +issues: #27314
|
|
| 3 | +mrs: !16118
|
|
| 4 | +synopsis:
|
|
| 5 | + Fix spurious ``-Wincomplete-uni-patterns`` warning under ``-finfo-table-map``.
|
|
| 6 | +description:
|
|
| 7 | + The pattern-match checker now ignores ticks when comparing scrutinees in
|
|
| 8 | + its CoreMap, so long-distance information is no longer lost across
|
|
| 9 | + function-application scrutinees because debug source annotations
|
|
| 10 | + (e.g. SourceNotes added by ``-finfo-table-map``) were inserted. |
| ... | ... | @@ -1000,8 +1000,9 @@ makeDictsCoherent (Case scrut bndr ty alts) |
| 1000 | 1000 | , let expr' = makeDictsCoherent expr ]
|
| 1001 | 1001 | makeDictsCoherent (Cast expr co)
|
| 1002 | 1002 | = Cast (makeDictsCoherent expr) co
|
| 1003 | -makeDictsCoherent (Tick tick expr)
|
|
| 1004 | - = Tick tick (makeDictsCoherent expr)
|
|
| 1003 | +makeDictsCoherent (Tick _tick expr)
|
|
| 1004 | + -- See Wrinkle (UD1) in Note [Unique dictionaries in the TmOracle CoreMap]
|
|
| 1005 | + = makeDictsCoherent expr
|
|
| 1005 | 1006 | makeDictsCoherent ty@(Type {})
|
| 1006 | 1007 | = ty
|
| 1007 | 1008 | makeDictsCoherent co@(Coercion {})
|
| ... | ... | @@ -1061,6 +1062,25 @@ In the end, replacing dictionaries with an error value in the pattern-match |
| 1061 | 1062 | checker was the most self-contained, although we might want to revisit once
|
| 1062 | 1063 | we implement a more robust approach to computing equality in the pattern-match
|
| 1063 | 1064 | checker (see #19272).
|
| 1065 | + |
|
| 1066 | +Wrinkle (UD1): ticks
|
|
| 1067 | +--------------------
|
|
| 1068 | +'makeDictsCoherent' also drops all ticks. The CoreMap key represents
|
|
| 1069 | +value-level equality, which ticks never affect.
|
|
| 1070 | + |
|
| 1071 | +Example (#27314): with -finfo-table-map every record-selector use site is
|
|
| 1072 | +wrapped in a 'SourceNote' carrying that site's span (see
|
|
| 1073 | +Note [Record-selector ticks] in GHC.HsToCore.Ticks). Given
|
|
| 1074 | + |
|
| 1075 | + data Box = Box { unBox :: Maybe Int }
|
|
| 1076 | + f b = case unBox b of
|
|
| 1077 | + Nothing -> 0
|
|
| 1078 | + Just _ -> let Just x = unBox b in x
|
|
| 1079 | + |
|
| 1080 | +the two `unBox b`s carry different SourceNote spans. Without tick stripping
|
|
| 1081 | +the CoreMap treats them as distinct expressions. Long-distance information
|
|
| 1082 | +from the outer `Just _` branch therefore never reaches the let-pattern, and
|
|
| 1083 | +`Just x = unBox b` is wrongly reported as non-exhaustive.
|
|
| 1064 | 1084 | -}
|
| 1065 | 1085 | |
| 1066 | 1086 | {- Note [The Pos/Neg invariant]
|
| ... | ... | @@ -12,7 +12,7 @@ module GHC.Tc.Errors( |
| 12 | 12 | |
| 13 | 13 | import GHC.Prelude
|
| 14 | 14 | |
| 15 | -import GHC.Builtin.Names (hasFieldClassName)
|
|
| 15 | +import GHC.Builtin.Names (hasFieldClassName, typeableClassName)
|
|
| 16 | 16 | |
| 17 | 17 | import GHC.Driver.Env (hsc_units)
|
| 18 | 18 | import GHC.Driver.DynFlags
|
| ... | ... | @@ -21,6 +21,7 @@ import GHC.Driver.Config.Diagnostic |
| 21 | 21 | |
| 22 | 22 | import GHC.Rename.Unbound
|
| 23 | 23 | |
| 24 | +import GHC.Tc.Instance.Typeable (kindIsTypeable)
|
|
| 24 | 25 | import GHC.Tc.Types
|
| 25 | 26 | import GHC.Tc.Utils.Monad
|
| 26 | 27 | import GHC.Tc.Errors.Types
|
| ... | ... | @@ -2565,9 +2566,52 @@ getNoBuiltinInstMsg item = |
| 2565 | 2566 | do { rdr_env <- getGlobalRdrEnv
|
| 2566 | 2567 | ; fam_envs <- tcGetFamInstEnvs
|
| 2567 | 2568 | ; mbNoHasFieldMsg <- hasFieldInfo_maybe rdr_env fam_envs item
|
| 2568 | - ; return $ fmap NoBuiltinHasFieldMsg mbNoHasFieldMsg
|
|
| 2569 | + ; mbNoTypeableMsg <- typeableInfo_maybe item
|
|
| 2570 | + ; return $ case (mbNoHasFieldMsg, mbNoTypeableMsg) of
|
|
| 2571 | + (Just hasFieldMsg, _) -> Just $ NoBuiltinHasFieldMsg hasFieldMsg
|
|
| 2572 | + (_, Just typeableMsg) -> Just $ NoBuiltinTypeableMsg typeableMsg
|
|
| 2573 | + _ -> Nothing
|
|
| 2569 | 2574 | }
|
| 2570 | 2575 | |
| 2576 | +-- | Try to produce an explanatory message for why GHC was not able to use
|
|
| 2577 | +-- a built-in instance to solve a 'Typeable' constraint.
|
|
| 2578 | +typeableInfo_maybe :: ErrorItem -> TcM (Maybe TypeableMsg)
|
|
| 2579 | +typeableInfo_maybe item
|
|
| 2580 | + | Just ty <- typeable_maybe (errorItemPred item)
|
|
| 2581 | + = if -- Polymorphic types like (forall a. a -> a) are not typeable
|
|
| 2582 | + -- see Note [No Typeable for polytypes or qualified types] in GHC.Tc.Instance.Class
|
|
| 2583 | + | isForAllTy ty -> return $ Just $ NoTypeableForPolytype ty
|
|
| 2584 | + |
|
| 2585 | + -- Qualified types like (Num a => blah) are not typeable
|
|
| 2586 | + | Just (af,_mult_,_arg,_ret) <- splitFunTy_maybe ty
|
|
| 2587 | + , not $ isVisibleFunArg af
|
|
| 2588 | + -> return $ Just $ NoTypeableForQualifiedType ty
|
|
| 2589 | + |
|
| 2590 | + -- Unboxed sum types like (# Int, Int #) are not typeable
|
|
| 2591 | + | Just (tc, _tys) <- splitTyConApp_maybe ty
|
|
| 2592 | + , isUnboxedSumTyCon tc -> return $ Just $ NoTypeableForUnboxedSumType ty
|
|
| 2593 | + |
|
| 2594 | + -- Unreduced type family applications are not typeable
|
|
| 2595 | + | Just (tc, _tys) <- splitTyConApp_maybe ty
|
|
| 2596 | + , isTypeFamilyTyCon tc -> return $ Just $ NoTypeableForUnreducedTypeFamilyApplication ty
|
|
| 2597 | + |
|
| 2598 | + -- TyCons whose kind is non-typeable, are not typeable
|
|
| 2599 | + | Just (tc, _tys) <- splitTyConApp_maybe ty
|
|
| 2600 | + , not (kindIsTypeable (tyConKind tc))
|
|
| 2601 | + -> return $ Just $ NoTypeableForTyConWithNonTypeableKind ty (tyConKind tc)
|
|
| 2602 | + |
|
| 2603 | + | otherwise -> return Nothing
|
|
| 2604 | + | otherwise = return Nothing
|
|
| 2605 | + |
|
| 2606 | +-- | Is this constraint definitely a 'Typeable' constraint?
|
|
| 2607 | +typeable_maybe :: PredType -> Maybe Type
|
|
| 2608 | +typeable_maybe pred =
|
|
| 2609 | + case classifyPredType pred of
|
|
| 2610 | + ClassPred cls tys
|
|
| 2611 | + | className cls == typeableClassName, [_k, ty] <- tys -> Just ty
|
|
| 2612 | + _ -> Nothing
|
|
| 2613 | + |
|
| 2614 | + |
|
| 2571 | 2615 | {- Note [Error messages for unsolved HasField constraints]
|
| 2572 | 2616 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 2573 | 2617 | The HasField type-class has special instance solving logic, implemented in
|
| ... | ... | @@ -2781,7 +2825,7 @@ hasFieldInfo_maybe rdr_env fam_inst_envs item |
| 2781 | 2825 | -> TcM (Maybe (Either (PatSyn, SimilarName) (TyCon, SimilarName)))
|
| 2782 | 2826 | with_parent n = fmap (bimap (,n) (,n)) <$> get_parent n
|
| 2783 | 2827 | |
| 2784 | --- | Is this constraint definitely 'HasField'?
|
|
| 2828 | +-- | Is this constraint definitely a 'HasField' constraint?
|
|
| 2785 | 2829 | hasField_maybe :: PredType -> Maybe (Type, Type, Type)
|
| 2786 | 2830 | hasField_maybe pred =
|
| 2787 | 2831 | case classifyPredType pred of
|
| ... | ... | @@ -4314,15 +4314,6 @@ pprTcSolverReportMsg ctxt |
| 4314 | 4314 | | any isFunTy (filterOutInvisibleTypes (classTyCon clas) tys)
|
| 4315 | 4315 | = text "(maybe you haven't applied a function to enough arguments?)"
|
| 4316 | 4316 | |
| 4317 | - -- Clarify the mysterious "No instance for (Typeable T)
|
|
| 4318 | - | className clas == typeableClassName
|
|
| 4319 | - , [_,ty] <- tys -- Look for (Typeable (k->*) (T k))
|
|
| 4320 | - , Just (tc,_) <- tcSplitTyConApp_maybe ty
|
|
| 4321 | - , not (isTypeFamilyTyCon tc)
|
|
| 4322 | - = hang (text "GHC can't yet do polykinded")
|
|
| 4323 | - 2 (text "Typeable" <+>
|
|
| 4324 | - parens (ppr ty <+> dcolon <+> ppr (typeKind ty)))
|
|
| 4325 | - |
|
| 4326 | 4317 | | otherwise
|
| 4327 | 4318 | = empty
|
| 4328 | 4319 | |
| ... | ... | @@ -5200,6 +5191,7 @@ pprCoercibleMsg (OutOfScopeNewtypeConstructor dc import_suggs) = |
| 5200 | 5191 | pprNoBuiltinInstanceMsg :: NoBuiltinInstanceMsg -> SDoc
|
| 5201 | 5192 | pprNoBuiltinInstanceMsg = \case
|
| 5202 | 5193 | NoBuiltinHasFieldMsg msg -> pprHasFieldMsg msg
|
| 5194 | + NoBuiltinTypeableMsg msg -> pprTypeableMsg msg
|
|
| 5203 | 5195 | |
| 5204 | 5196 | pprHasFieldMsg :: HasFieldMsg -> SDoc
|
| 5205 | 5197 | pprHasFieldMsg = \case
|
| ... | ... | @@ -5278,6 +5270,28 @@ pprHasFieldPatSynMsg fld pat_syns = |
| 5278 | 5270 | in
|
| 5279 | 5271 | packHText occ == field_label fld
|
| 5280 | 5272 | |
| 5273 | +pprTypeableMsg :: TypeableMsg -> SDoc
|
|
| 5274 | +pprTypeableMsg = \case
|
|
| 5275 | + NoTypeableForPolytype ty ->
|
|
| 5276 | + ppr_is ty "a polymorphic type"
|
|
| 5277 | + NoTypeableForQualifiedType ty ->
|
|
| 5278 | + ppr_is ty "a qualified type"
|
|
| 5279 | + NoTypeableForUnboxedSumType ty ->
|
|
| 5280 | + ppr_is ty "an unboxed sum type"
|
|
| 5281 | + NoTypeableForUnreducedTypeFamilyApplication ty ->
|
|
| 5282 | + ppr_is ty "an unreduced type family application"
|
|
| 5283 | + NoTypeableForTyConWithNonTypeableKind ty k ->
|
|
| 5284 | + vcat
|
|
| 5285 | + [ text "NB:" <+> "The kind of" <+> quotes (ppr ty)
|
|
| 5286 | + , nest 2 (quotes (ppr k)) <+> "contains foralls,"
|
|
| 5287 | + , "for which the built-in"
|
|
| 5288 | + <+> quotes (text "Typeable") <+> text "solver cannot produce evidence." ]
|
|
| 5289 | + where
|
|
| 5290 | + ppr_is ty reason =
|
|
| 5291 | + text "NB:" <+> quotes (ppr ty) <+> text "is" <+> text reason
|
|
| 5292 | + $$ "for which the built-in"
|
|
| 5293 | + <+> quotes (text "Typeable") <+> text "solver cannot produce evidence."
|
|
| 5294 | + |
|
| 5281 | 5295 | pprWhenMatching :: SolverReportErrCtxt -> WhenMatching -> SDoc
|
| 5282 | 5296 | pprWhenMatching ctxt (WhenMatching cty1 cty2 sub_o mb_sub_t_or_k) =
|
| 5283 | 5297 | sdocOption sdocPrintExplicitCoercions $ \printExplicitCoercions ->
|
| ... | ... | @@ -5516,6 +5530,7 @@ tcSolverReportMsgHints ctxt = \case |
| 5516 | 5530 | noBuiltinInstanceHints :: NoBuiltinInstanceMsg -> [GhcHint]
|
| 5517 | 5531 | noBuiltinInstanceHints = \case
|
| 5518 | 5532 | NoBuiltinHasFieldMsg noHasFieldMsg -> hasFieldMsgHints noHasFieldMsg
|
| 5533 | + NoBuiltinTypeableMsg _ -> noHints
|
|
| 5519 | 5534 | |
| 5520 | 5535 | hasFieldMsgHints :: HasFieldMsg -> [GhcHint]
|
| 5521 | 5536 | hasFieldMsgHints = \case
|
| ... | ... | @@ -7998,4 +8013,3 @@ pprHsCtxt = \case |
| 7998 | 8013 | ppr_stmt (TransStmt { trS_by = by, trS_using = using
|
| 7999 | 8014 | , trS_form = form }) = pprTransStmt by using form
|
| 8000 | 8015 | ppr_stmt stmt = pprStmt stmt |
| 8001 | - |
| ... | ... | @@ -78,6 +78,7 @@ module GHC.Tc.Errors.Types ( |
| 78 | 78 | , CoercibleMsg(..)
|
| 79 | 79 | , NoBuiltinInstanceMsg(..)
|
| 80 | 80 | , HasFieldMsg(..)
|
| 81 | + , TypeableMsg(..)
|
|
| 81 | 82 | , TooFancyField(..)
|
| 82 | 83 | , PotentialInstances(..)
|
| 83 | 84 | , UnsupportedCallConvention(..)
|
| ... | ... | @@ -6034,9 +6035,9 @@ data CoercibleMsg |
| 6034 | 6035 | -- a particular class.
|
| 6035 | 6036 | data NoBuiltinInstanceMsg
|
| 6036 | 6037 | = NoBuiltinHasFieldMsg HasFieldMsg
|
| 6038 | + | NoBuiltinTypeableMsg TypeableMsg
|
|
| 6037 | 6039 | |
| 6038 | 6040 | -- Other useful constructors might be:
|
| 6039 | - -- NoBuiltinTypeableMsg -- explains polykinded Typeable restrictions
|
|
| 6040 | 6041 | -- NoBuiltinDataToTagMsg -- see conditions in Note [DataToTag overview]
|
| 6041 | 6042 | -- NoBuiltinWithDictMsg -- see Note [withDict]
|
| 6042 | 6043 | |
| ... | ... | @@ -6066,6 +6067,20 @@ data HasFieldMsg |
| 6066 | 6067 | -- | Using -XRebindableSyntax and a different 'HasField'.
|
| 6067 | 6068 | | CustomHasField TyCon -- ^ the custom HasField TyCon
|
| 6068 | 6069 | |
| 6070 | +-- | Explains why GHC wasn't able to provide a built-in 'Typeable' instance
|
|
| 6071 | +-- for the given types.
|
|
| 6072 | +data TypeableMsg
|
|
| 6073 | + -- | Polymorphic types are not typeable.
|
|
| 6074 | + = NoTypeableForPolytype Type
|
|
| 6075 | + -- | Qualified types are not typeable.
|
|
| 6076 | + | NoTypeableForQualifiedType Type
|
|
| 6077 | + -- | Unboxed sum types are not typeable.
|
|
| 6078 | + | NoTypeableForUnboxedSumType Type
|
|
| 6079 | + -- | Unreduced Type Family Applications are not typeable.
|
|
| 6080 | + | NoTypeableForUnreducedTypeFamilyApplication Type
|
|
| 6081 | + -- | TyCons whose kind is not typeable are not typeable.
|
|
| 6082 | + | NoTypeableForTyConWithNonTypeableKind Type Kind
|
|
| 6083 | + |
|
| 6069 | 6084 | -- | Why is a record field "too fancy" for GHC to be able to properly
|
| 6070 | 6085 | -- solve a 'HasField' constraint?
|
| 6071 | 6086 | data TooFancyField
|
| ... | ... | @@ -7,7 +7,12 @@ |
| 7 | 7 | {-# LANGUAGE RecordWildCards #-}
|
| 8 | 8 | {-# LANGUAGE TypeFamilies #-}
|
| 9 | 9 | |
| 10 | -module GHC.Tc.Instance.Typeable(mkTypeableBinds, tyConIsTypeable) where
|
|
| 10 | +module GHC.Tc.Instance.Typeable (
|
|
| 11 | + mkTypeableBinds
|
|
| 12 | + , tyConIsTypeable
|
|
| 13 | + , kindIsTypeable
|
|
| 14 | + )
|
|
| 15 | +where
|
|
| 11 | 16 | |
| 12 | 17 | import GHC.Prelude
|
| 13 | 18 | import GHC.Platform
|
| ... | ... | @@ -40,14 +40,14 @@ import GHC.Internal.IO.Handle.Lock.NoOp |
| 40 | 40 | -- to interrupt it with asynchronous exceptions and/or for other threads to
|
| 41 | 41 | -- continue working, you MUST use threaded version of the runtime system.
|
| 42 | 42 | --
|
| 43 | --- 2. The implementation uses relies on any of a number of locking
|
|
| 44 | --- facilities, depending upon what the platform supports:
|
|
| 43 | +-- 2. The implementation relies on any of a number of locking
|
|
| 44 | +-- facilities, depending upon what the platform supports:
|
|
| 45 | 45 | --
|
| 46 | --- * 'LockFileEx' is used on Windows
|
|
| 47 | --- * On platforms that support it we use the @F_OFD_SETLK@ and @F_OFD_SETLKW@ @fnctl@s.
|
|
| 48 | --- * Otherwise we use @flock@
|
|
| 46 | +-- * 'LockFileEx' is used on Windows
|
|
| 47 | +-- * On platforms that support it we use the @F_OFD_SETLK@ and @F_OFD_SETLKW@ @fnctl@s.
|
|
| 48 | +-- * Otherwise we use @flock@
|
|
| 49 | 49 | --
|
| 50 | --- hence all of their caveats also apply here.
|
|
| 50 | +-- All of their caveats also apply here.
|
|
| 51 | 51 | --
|
| 52 | 52 | -- 3. On non-Windows platforms that don't support 'flock' (e.g. Solaris) this
|
| 53 | 53 | -- function throws 'FileLockingNotImplemented'. We deliberately choose to not
|
| ... | ... | @@ -2018,8 +2018,10 @@ bool nonmovingTidyWeaks (struct MarkQueue_ *queue) |
| 2018 | 2018 | |
| 2019 | 2019 | // See Note [Weak pointer processing and the non-moving GC] in
|
| 2020 | 2020 | // MarkWeak.c
|
| 2021 | - bdescr *key_bd = Bdescr((StgPtr) w->key);
|
|
| 2022 | - bool key_in_nonmoving = HEAP_ALLOCED_GC(w->key) && block_get_flags(key_bd) & BF_NONMOVING;
|
|
| 2021 | + bool key_in_nonmoving =
|
|
| 2022 | + HEAP_ALLOCED_GC(w->key) &&
|
|
| 2023 | + block_get_flags(Bdescr((StgPtr) w->key)) & BF_NONMOVING;
|
|
| 2024 | + |
|
| 2023 | 2025 | if (!key_in_nonmoving || nonmovingIsNowAlive(w->key)) {
|
| 2024 | 2026 | nonmovingMarkLiveWeak(queue, w);
|
| 2025 | 2027 | did_work = true;
|
| 1 | +module T27314 where
|
|
| 2 | + |
|
| 3 | +data Box = Box { unBox :: Maybe Int }
|
|
| 4 | + |
|
| 5 | +f :: Box -> Int
|
|
| 6 | +f b = case unBox b of
|
|
| 7 | + Nothing -> 0
|
|
| 8 | + Just _ -> let Just x = unBox b in x |
| ... | ... | @@ -93,6 +93,14 @@ test('T21360', normal, compile, [overlapping_incomplete+'-Wincomplete-record-upd |
| 93 | 93 | test('T21360b', normal, compile, [overlapping_incomplete+'-Wincomplete-record-updates'])
|
| 94 | 94 | test('T23520', normal, compile, [overlapping_incomplete+'-Wincomplete-record-updates'])
|
| 95 | 95 | test('T25164', [extra_files(['T25164_aux.hs']), req_th], multimod_compile, ['T25164', '-v0'])
|
| 96 | +test(
|
|
| 97 | + 'T27314',
|
|
| 98 | + [ omit_ways(llvm_ways), # -finfo-table-map does not work with -fllvm (#26435)
|
|
| 99 | + when(js_arch(), skip) # javascript doesn't support -finfo-table-map yet and yields a warning we don't want to handle here
|
|
| 100 | + ],
|
|
| 101 | + compile,
|
|
| 102 | + ['-Wincomplete-uni-patterns -finfo-table-map']
|
|
| 103 | +)
|
|
| 96 | 104 | |
| 97 | 105 | # Other tests
|
| 98 | 106 | test('pmc001', [], compile, [overlapping_incomplete])
|
| 1 | 1 | T15067.hs:9:14: error: [GHC-39999]
|
| 2 | 2 | • No instance for ‘Typeable (# | #)’
|
| 3 | 3 | arising from a use of ‘typeRep’
|
| 4 | - GHC can't yet do polykinded
|
|
| 5 | - Typeable ((# | #) :: *
|
|
| 6 | - -> *
|
|
| 7 | - -> TYPE
|
|
| 8 | - (GHC.Internal.Types.SumRep
|
|
| 9 | - [GHC.Internal.Types.LiftedRep,
|
|
| 10 | - GHC.Internal.Types.LiftedRep]))
|
|
| 4 | + NB: ‘(# | #)’ is an unboxed sum type
|
|
| 5 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 11 | 6 | • In the expression: typeRep
|
| 12 | 7 | In an equation for ‘floopadoop’: floopadoop = typeRep |
| 13 | - |
| 1 | +{-# LANGUAGE ImpredicativeTypes #-}
|
|
| 2 | +{-# LANGUAGE UnboxedSums #-}
|
|
| 3 | +{-# LANGUAGE TypeFamilies #-}
|
|
| 4 | + |
|
| 5 | +module T26532 where
|
|
| 6 | + |
|
| 7 | +import Data.Kind
|
|
| 8 | +import Type.Reflection
|
|
| 9 | + |
|
| 10 | +test1 :: TypeRep (forall a. a -> a)
|
|
| 11 | +test1 = typeRep
|
|
| 12 | + |
|
| 13 | +test2 :: TypeRep (Eq Int => Int)
|
|
| 14 | +test2 = typeRep
|
|
| 15 | + |
|
| 16 | +test3 :: TypeRep (((),()) => Int)
|
|
| 17 | +test3 = typeRep
|
|
| 18 | + |
|
| 19 | +test4 :: TypeRep (# Int | Bool #)
|
|
| 20 | +test4 = typeRep
|
|
| 21 | + |
|
| 22 | +type F :: Type -> Type
|
|
| 23 | +type family F a where {}
|
|
| 24 | + |
|
| 25 | +test5 :: TypeRep (F Int)
|
|
| 26 | +test5 = typeRep
|
|
| 27 | + |
|
| 28 | +type PolyDF :: forall k. Type -> k
|
|
| 29 | +data family PolyDF a
|
|
| 30 | + |
|
| 31 | +type ProxyPolyDF :: (forall k. Type -> k) -> Type
|
|
| 32 | +data ProxyPolyDF f = MkProxy
|
|
| 33 | + |
|
| 34 | +test6 :: TypeRep (ProxyPolyDF PolyDF)
|
|
| 35 | +test6 = typeRep |
| 1 | +T26532.hs:11:9: error: [GHC-39999]
|
|
| 2 | + • No instance for ‘Typeable (forall a. a -> a)’
|
|
| 3 | + arising from a use of ‘typeRep’
|
|
| 4 | + NB: ‘forall a. a -> a’ is a polymorphic type
|
|
| 5 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 6 | + • In the expression: typeRep
|
|
| 7 | + In an equation for ‘test1’: test1 = typeRep
|
|
| 8 | + |
|
| 9 | +T26532.hs:14:9: error: [GHC-39999]
|
|
| 10 | + • No instance for ‘Typeable (Eq Int => Int)’
|
|
| 11 | + arising from a use of ‘typeRep’
|
|
| 12 | + NB: ‘Eq Int => Int’ is a qualified type
|
|
| 13 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 14 | + • In the expression: typeRep
|
|
| 15 | + In an equation for ‘test2’: test2 = typeRep
|
|
| 16 | + |
|
| 17 | +T26532.hs:17:9: error: [GHC-39999]
|
|
| 18 | + • No instance for ‘Typeable
|
|
| 19 | + ((() :: Constraint, () :: Constraint) => Int)’
|
|
| 20 | + arising from a use of ‘typeRep’
|
|
| 21 | + NB: ‘(() :: Constraint, () :: Constraint) =>
|
|
| 22 | + Int’ is a qualified type
|
|
| 23 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 24 | + • In the expression: typeRep
|
|
| 25 | + In an equation for ‘test3’: test3 = typeRep
|
|
| 26 | + |
|
| 27 | +T26532.hs:20:9: error: [GHC-39999]
|
|
| 28 | + • No instance for ‘Typeable (# | #)’
|
|
| 29 | + arising from a use of ‘typeRep’
|
|
| 30 | + NB: ‘(# | #)’ is an unboxed sum type
|
|
| 31 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 32 | + • In the expression: typeRep
|
|
| 33 | + In an equation for ‘test4’: test4 = typeRep
|
|
| 34 | + |
|
| 35 | +T26532.hs:26:9: error: [GHC-39999]
|
|
| 36 | + • No instance for ‘Typeable (F Int)’
|
|
| 37 | + arising from a use of ‘typeRep’
|
|
| 38 | + NB: ‘F Int’ is an unreduced type family application
|
|
| 39 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 40 | + • In the expression: typeRep
|
|
| 41 | + In an equation for ‘test5’: test5 = typeRep
|
|
| 42 | + |
|
| 43 | +T26532.hs:35:9: error: [GHC-39999]
|
|
| 44 | + • No instance for ‘Typeable ProxyPolyDF’
|
|
| 45 | + arising from a use of ‘typeRep’
|
|
| 46 | + NB: The kind of ‘ProxyPolyDF’
|
|
| 47 | + ‘(forall k. * -> k) -> *’ contains foralls,
|
|
| 48 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 49 | + • In the expression: typeRep
|
|
| 50 | + In an equation for ‘test6’: test6 = typeRep |
| ... | ... | @@ -2,7 +2,8 @@ |
| 2 | 2 | T9858b.hs:7:8: error: [GHC-39999]
|
| 3 | 3 | • No instance for ‘Typeable (Eq Int => Int)’
|
| 4 | 4 | arising from a use of ‘typeRep’
|
| 5 | - (maybe you haven't applied a function to enough arguments?)
|
|
| 5 | + NB: ‘Eq Int => Int’ is a qualified type
|
|
| 6 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 6 | 7 | • In the expression: typeRep (Proxy :: Proxy (Eq Int => Int))
|
| 7 | 8 | In an equation for ‘test’:
|
| 8 | 9 | test = typeRep (Proxy :: Proxy (Eq Int => Int)) |
| ... | ... | @@ -11,6 +11,7 @@ TcStaticPointersFail02.hs:12:6: error: [GHC-39999] |
| 11 | 11 | • No instance for ‘ghc-internal-0.1.0.0:GHC.Internal.Data.Typeable.Internal.Typeable
|
| 12 | 12 | (Monad m => a -> m a)’
|
| 13 | 13 | arising from a static form
|
| 14 | - (maybe you haven't applied a function to enough arguments?)
|
|
| 14 | + NB: ‘Monad m => a -> m a’ is a qualified type
|
|
| 15 | + for which the built-in ‘Typeable’ solver cannot produce evidence.
|
|
| 15 | 16 | • In the expression: static return
|
| 16 | 17 | In an equation for ‘f2’: f2 = static return |
| ... | ... | @@ -761,3 +761,4 @@ test('T26823', normal, compile_fail, ['']) |
| 761 | 761 | test('T26861', normal, compile_fail, [''])
|
| 762 | 762 | test('T26862', normal, compile_fail, [''])
|
| 763 | 763 | test('T27210', normal, compile_fail, [''])
|
| 764 | +test('T26532', normal, compile_fail, ['']) |