Magnus pushed to branch wip/mangoiv/backport-unused-type at Glasgow Haskell Compiler / GHC

Commits:

8 changed files:

Changes:

  • compiler/GHC/Builtin/Names.hs
    ... ... @@ -2007,8 +2007,8 @@ unsatisfiableClassNameKey = mkPreludeTyConUnique 170
    2007 2007
     anyTyConKey :: Unique
    
    2008 2008
     anyTyConKey = mkPreludeTyConUnique 171
    
    2009 2009
     
    
    2010
    -zonkAnyTyConKey :: Unique
    
    2011
    -zonkAnyTyConKey = mkPreludeTyConUnique 172
    
    2010
    +unusedTypeTyConKey :: Unique
    
    2011
    +unusedTypeTyConKey = mkPreludeTyConUnique 172
    
    2012 2012
     
    
    2013 2013
     -- Custom user type-errors
    
    2014 2014
     errorMessageTypeErrorFamKey :: Unique
    

  • compiler/GHC/Builtin/Types.hs
    ... ... @@ -92,7 +92,7 @@ module GHC.Builtin.Types (
    92 92
             cTupleSelId, cTupleSelIdName,
    
    93 93
     
    
    94 94
             -- * Any
    
    95
    -        anyTyCon, anyTy, anyTypeOfKind, zonkAnyTyCon,
    
    95
    +        anyTyCon, anyTy, anyTypeOfKind, unusedTypeTyCon,
    
    96 96
     
    
    97 97
             -- * Recovery TyCon
    
    98 98
             makeRecoveryTyCon,
    
    ... ... @@ -310,7 +310,7 @@ wiredInTyCons = map (dataConTyCon . snd) boxingDataCons
    310 310
                     , soloTyCon
    
    311 311
     
    
    312 312
                     , anyTyCon
    
    313
    -                , zonkAnyTyCon
    
    313
    +                , unusedTypeTyCon
    
    314 314
                     , boolTyCon
    
    315 315
                     , charTyCon
    
    316 316
                     , stringTyCon
    
    ... ... @@ -421,13 +421,13 @@ doubleDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "D#")
    421 421
     {-
    
    422 422
     Note [Any types]
    
    423 423
     ~~~~~~~~~~~~~~~~
    
    424
    -The type constructors `Any` and `ZonkAny` are closed type families declared thus:
    
    424
    +The type constructors `Any` and `UnusedType` are closed type families declared thus:
    
    425 425
     
    
    426
    -    type family Any     :: forall k.        k where { }
    
    427
    -    type family ZonkAny :: forall k. Nat -> k where { }
    
    426
    +    type family Any        :: forall k.                  k where { }
    
    427
    +    type family UnusedType :: forall k. Nat -> Symbol -> k where { }
    
    428 428
     
    
    429 429
     They are used when we want a type of a particular kind, but we don't really care
    
    430
    -what that type is.  The leading example is this: `ZonkAny` is used to instantiate
    
    430
    +what that type is.  The leading example is this: `UnusedType` is used to instantiate
    
    431 431
     un-constrained type variables after type checking. For example, consider the
    
    432 432
     term (length [] :: Int), where
    
    433 433
     
    
    ... ... @@ -440,26 +440,26 @@ The typechecker will end up with
    440 440
       length @alpha ([] @alpha)
    
    441 441
     
    
    442 442
     where `alpha` is an un-constrained unification variable.  The "zonking" process zaps
    
    443
    -that unconstrained `alpha` to an arbitrary type (ZonkAny @Type 3), where the `3` is
    
    444
    -arbitrary (see wrinkle (Any5) below).  This is done in `GHC.Tc.Zonk.Type.commitFlexi`.
    
    445
    -So we end up with
    
    443
    +that unconstrained `alpha` to an arbitrary type (UnusedType @Type 3 "a"), where the `3` is
    
    444
    +arbitrary (see wrinkle (Any5) below). and `a` is the original name, if we have one.
    
    445
    +This is done in `GHC.Tc.Zonk.Type.commitFlexi`. So we end up with
    
    446 446
     
    
    447
    -  length @(ZonkAny @Type 3) ([] @(ZonkAny @Type 3))
    
    447
    +  length @(UnusedType @Type 3 "a") ([] @(UnusedType @Type 3 "a"))
    
    448 448
     
    
    449
    -`Any` and `ZonkAny` differ only in the presence of the `Nat` argument; see
    
    450
    -wrinkle (Any4).
    
    449
    +`Any` and `UnusedType` differ only in the presence of the `Nat` and the `Symbol` arguments;
    
    450
    +see wrinkle (Any4).
    
    451 451
     
    
    452 452
     Wrinkles:
    
    453 453
     
    
    454
    -(Any1) `Any` and `ZonkAny` are kind polymorphic since in some program we may
    
    455
    -   need to use `ZonkAny` to fill in a type variable of some kind other than *
    
    454
    +(Any1) `Any` and `UnusedType` are kind polymorphic since in some program we may
    
    455
    +   need to use `UnusedType` to fill in a type variable of some kind other than *
    
    456 456
        (see #959 for examples).
    
    457 457
     
    
    458 458
     (Any2) They are /closed/ type families, with no instances.  For example, suppose that
    
    459 459
        with  alpha :: '(k1, k2)  we add a given coercion
    
    460 460
                  g :: alpha ~ (Fst alpha, Snd alpha)
    
    461
    -   and we zonked alpha = ZonkAny @(k1,k2) n.  Then, if `ZonkAny` was a /data/ type,
    
    462
    -   we'd get inconsistency because we'd have a Given equality with `ZonkAny` on one
    
    461
    +   and we zonked alpha = UnusedType @(k1,k2) n.  Then, if `UnusedType` was a /data/ type,
    
    462
    +   we'd get inconsistency because we'd have a Given equality with `UnusedType` on one
    
    463 463
        side and '(,) on the other. See also #9097 and #9636.
    
    464 464
     
    
    465 465
        See #25244 for a suggestion that we instead use an /open/ type family for which
    
    ... ... @@ -469,7 +469,7 @@ Wrinkles:
    469 469
        the code generator, because the code gen may /enter/ a data value
    
    470 470
        but never enters a function value.
    
    471 471
     
    
    472
    -(Any4) `ZonkAny` takes a `Nat` argument so that we can readily make up /distinct/
    
    472
    +(Any4) `UnusedType` takes a `Nat` argument so that we can readily make up /distinct/
    
    473 473
        types (#24817).  Consider
    
    474 474
     
    
    475 475
          data SBool a where { STrue :: SBool True; SFalse :: SBool False }
    
    ... ... @@ -484,17 +484,29 @@ Wrinkles:
    484 484
        Now, what are `alpha` and `beta`? If we zonk both of them to the same type
    
    485 485
        `Any @Type`, the pattern-match checker will (wrongly) report that the first
    
    486 486
        branch is inaccessible.  So we zonk them to two /different/ types:
    
    487
    -       alpha :=  ZonkAny @Type 4   and   beta :=  ZonkAny @Type k 5
    
    487
    +       alpha :=  UnusedType @Type 4 "a"  and   beta :=  UnusedType @Type k 5 "b"
    
    488 488
        (The actual numbers are arbitrary; they just need to differ.)
    
    489 489
     
    
    490 490
        The unique-name generation comes from field `tcg_zany_n` of `TcGblEnv`; and
    
    491
    -   `GHC.Tc.Zonk.Type.commitFlexi` calls `GHC.Tc.Utils.Monad.newZonkAnyType` to
    
    491
    +   `GHC.Tc.Zonk.Type.commitFlexi` calls `GHC.Tc.Utils.Monad.newUnusedTypeType` to
    
    492 492
        make up a fresh type.
    
    493 493
     
    
    494 494
        If this example seems unconvincing (e.g. in this case foo must be bottom)
    
    495 495
        see #24817 for larger but more compelling examples.
    
    496 496
     
    
    497
    -(Any5) `Any` and `ZonkAny` are wired-in so we can easily refer to it where we
    
    497
    +   `UnusedType` takes a `Symbol` argument so we can neatly display the type to the user.
    
    498
    +   While `UnusedType` ought to be an implementation detail, we sometimes leak it to the
    
    499
    +   user, especially in consumers of the GHC api like haskell-language-server.
    
    500
    +   The user does not know what an `UnusedType` is and just expects a meta variable.
    
    501
    +   However, since the process of zonking should remove all meta variables, we just try to
    
    502
    +   reconstruct it when pretty printing, e.g.
    
    503
    +   `UnusedType 3 "foo" :: Type` becomes `foo_3`
    
    504
    +
    
    505
    +   Historical note: `UnusedType` was called `ZonkAny` in older versions of the compiler
    
    506
    +   but since this is a leaky abstractions (see above) we give it this improved name
    
    507
    +   and handle it specially in the pretty printer to avoid confusion of the user.
    
    508
    +
    
    509
    +(Any5) `Any` and `UnusedType` are wired-in so we can easily refer to it where we
    
    498 510
         don't have a name environment (e.g. see Rules.matchRule for one example)
    
    499 511
     
    
    500 512
     (Any6) `Any` is defined in library module ghc-prim:GHC.Types, and exported so that
    
    ... ... @@ -502,7 +514,7 @@ Wrinkles:
    502 514
         wired-in type:
    
    503 515
           - has a fixed unique, anyTyConKey,
    
    504 516
           - lives in the global name cache
    
    505
    -    Currently `ZonkAny` is not available to users; but it could easily be.
    
    517
    +    Currently `UnusedType` is not available to users; but it could easily be.
    
    506 518
     
    
    507 519
     (Any7) Properties of `Any`:
    
    508 520
       * When `Any` is instantiated at a lifted type it is inhabited by at least one value,
    
    ... ... @@ -521,6 +533,17 @@ Wrinkles:
    521 533
     
    
    522 534
         See examples in ghc-prim:GHC.Types
    
    523 535
     
    
    536
    +(Any8) Warning about unused bindings of type `Any` and `UnusedType` are suppressed,
    
    537
    +    following the same rationale of supressing warning about the unit type.
    
    538
    +
    
    539
    +    For example, consider (#25895):
    
    540
    +
    
    541
    +     do { forever (return ()); blah }
    
    542
    +
    
    543
    +    where forever :: forall a b. IO a -> IO b
    
    544
    +    Nothing constrains `b`, so it will be instantiates with `Any` or `UnusedType`.
    
    545
    +    But we certainly don't want to complain about a discarded do-binding.
    
    546
    +
    
    524 547
     The Any tycon used to be quite magic, but we have since been able to
    
    525 548
     implement it merely with an empty kind polymorphic type family. See #10886 for a
    
    526 549
     bit of history.
    
    ... ... @@ -547,23 +570,25 @@ anyTy = mkTyConTy anyTyCon
    547 570
     anyTypeOfKind :: Kind -> Type
    
    548 571
     anyTypeOfKind kind = mkTyConApp anyTyCon [kind]
    
    549 572
     
    
    550
    -zonkAnyTyConName :: Name
    
    551
    -zonkAnyTyConName =
    
    552
    -    mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "ZonkAny") zonkAnyTyConKey zonkAnyTyCon
    
    573
    +unusedTypeTyConName :: Name
    
    574
    +unusedTypeTyConName =
    
    575
    +    mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "UnusedType") unusedTypeTyConKey unusedTypeTyCon
    
    553 576
     
    
    554
    -zonkAnyTyCon :: TyCon
    
    555
    --- ZonkAnyTyCon :: forall k. Nat -> k
    
    577
    +unusedTypeTyCon :: TyCon
    
    578
    +-- unusedTypeTyCon :: forall k. Nat -> Symbol -> k
    
    556 579
     -- See Note [Any types]
    
    557
    -zonkAnyTyCon = mkFamilyTyCon zonkAnyTyConName
    
    558
    -                         [ mkNamedTyConBinder Specified kv
    
    559
    -                         , mkAnonTyConBinder nat_kv ]
    
    560
    -                         (mkTyVarTy kv)
    
    580
    +unusedTypeTyCon = mkFamilyTyCon unusedTypeTyConName bndrs res_kind
    
    561 581
                              Nothing
    
    562 582
                              (ClosedSynFamilyTyCon Nothing)
    
    563 583
                              Nothing
    
    564 584
                              NotInjective
    
    565 585
       where
    
    566
    -    [kv,nat_kv] = mkTemplateKindVars [liftedTypeKind, naturalTy]
    
    586
    +    [kv,nat_kv,sym_kv] = mkTemplateKindVars [liftedTypeKind, naturalTy, typeSymbolKind]
    
    587
    +    bndrs = [ mkNamedTyConBinder Specified kv
    
    588
    +            , mkAnonTyConBinder nat_kv
    
    589
    +            , mkAnonTyConBinder sym_kv ]
    
    590
    +    res_kind = mkTyVarTy kv
    
    591
    +    kind = mkTyConKind bndrs res_kind
    
    567 592
     
    
    568 593
     -- | Make a fake, recovery 'TyCon' from an existing one.
    
    569 594
     -- Used when recovering from errors in type declarations
    

  • compiler/GHC/HsToCore/Expr.hs
    ... ... @@ -985,9 +985,13 @@ warnDiscardedDoBindings rhs rhs_ty
    985 985
            ; when (warn_unused || warn_wrong) $
    
    986 986
         do { fam_inst_envs <- dsGetFamInstEnvs
    
    987 987
            ; let norm_elt_ty = topNormaliseType fam_inst_envs elt_ty
    
    988
    -
    
    989
    -           -- Warn about discarding non-() things in 'monadic' binding
    
    990
    -       ; if warn_unused && not (isUnitTy norm_elt_ty)
    
    988
    +             supressible_ty =
    
    989
    +               isUnitTy norm_elt_ty || isAnyTy norm_elt_ty || isUnusedTypeTy norm_elt_ty
    
    990
    +         -- Warn about discarding things in 'monadic' binding,
    
    991
    +         -- however few types are excluded:
    
    992
    +         --   * Unit type `()`
    
    993
    +         --   * `UnusedType` or `Any` type see (Any8) of Note [Any types]
    
    994
    +       ; if warn_unused && not supressible_ty
    
    991 995
              then diagnosticDs (DsUnusedDoBind rhs elt_ty)
    
    992 996
              else
    
    993 997
     
    

  • compiler/GHC/Iface/Type.hs
    ... ... @@ -7,7 +7,7 @@ This module defines interface types and binders
    7 7
     -}
    
    8 8
     
    
    9 9
     
    
    10
    -{-# LANGUAGE MultiWayIf #-}
    
    10
    +{-# LANGUAGE MultiWayIf, OverloadedRecordDot #-}
    
    11 11
     {-# LANGUAGE LambdaCase #-}
    
    12 12
     module GHC.Iface.Type (
    
    13 13
             IfExtName,
    
    ... ... @@ -1664,6 +1664,7 @@ pprTyTcApp ctxt_prec tc tys =
    1664 1664
         sdocOption sdocPrintExplicitKinds $ \print_kinds ->
    
    1665 1665
         sdocOption sdocPrintTypeAbbreviations $ \print_type_abbreviations ->
    
    1666 1666
         getPprDebug $ \debug ->
    
    1667
    +    getPprStyle $ \style ->
    
    1667 1668
     
    
    1668 1669
         if | ifaceTyConName tc `hasKey` ipClassKey
    
    1669 1670
            , IA_Arg (IfaceLitTy (IfaceStrTyLit n))
    
    ... ... @@ -1715,6 +1716,12 @@ pprTyTcApp ctxt_prec tc tys =
    1715 1716
            | Just doc <- ppr_equality ctxt_prec tc (appArgsIfaceTypes tys)
    
    1716 1717
            -> doc
    
    1717 1718
     
    
    1719
    +       | ifaceTyConName tc `hasKey` unusedTypeTyConKey
    
    1720
    +       , (arg_k : IfaceLitTy (IfaceNumTyLit arg_n) : IfaceLitTy (IfaceStrTyLit arg_nm) : _) <- appArgsIfaceTypes tys
    
    1721
    +         -- if arg_k is a kind with more than 0 arguments, then _ might not be [] here
    
    1722
    +       , userStyle style
    
    1723
    +       -> ppr_iface_unused_ty_tycon ctxt_prec arg_k arg_n arg_nm
    
    1724
    +
    
    1718 1725
            | otherwise
    
    1719 1726
            -> ppr_iface_tc_app ppr_app_arg ctxt_prec tc $
    
    1720 1727
               appArgsIfaceTypesForAllTyFlags $ stripInvisArgs (PrintExplicitKinds print_kinds) tys
    
    ... ... @@ -1727,6 +1734,15 @@ ppr_kind_type ctxt_prec = sdocOption sdocStarIsType $ \case
    1727 1734
        True  -> maybeParen ctxt_prec starPrec $
    
    1728 1735
                   unicodeSyntax (char '★') (char '*')
    
    1729 1736
     
    
    1737
    +ppr_iface_unused_ty_tycon :: PprPrec -> IfaceType -> Integer -> LexicalFastString -> SDoc
    
    1738
    +ppr_iface_unused_ty_tycon ctxt_prec arg_k arg_n arg_nm
    
    1739
    +  = sdocOption sdocPrintExplicitKinds       $ \print_kinds ->
    
    1740
    +    sdocOption sdocPrintExplicitRuntimeReps $ \print_reps  ->
    
    1741
    +      if print_kinds || print_reps
    
    1742
    +      then maybeParen ctxt_prec sigPrec $ prettyMeta <+> text "::" <+> pprIfaceType arg_k
    
    1743
    +      else prettyMeta
    
    1744
    +  where prettyMeta = ppr arg_nm <> ppr arg_n
    
    1745
    +
    
    1730 1746
     -- | Pretty-print a type-level equality.
    
    1731 1747
     -- Returns (Just doc) if the argument is a /saturated/ application
    
    1732 1748
     -- of   eqTyCon          (~)
    
    ... ... @@ -2113,7 +2129,8 @@ instance Binary IfaceTyConSort where
    2113 2129
              0 -> return IfaceNormalTyCon
    
    2114 2130
              1 -> IfaceTupleTyCon <$> get bh <*> get bh
    
    2115 2131
              2 -> IfaceSumTyCon <$> get bh
    
    2116
    -         _ -> return IfaceEqualityTyCon
    
    2132
    +         3 -> return IfaceEqualityTyCon
    
    2133
    +         _ -> panic "get IfaceTyConSort"
    
    2117 2134
     
    
    2118 2135
     instance Binary IfaceTyConInfo where
    
    2119 2136
        put_ bh (IfaceTyConInfo i s) = put_ bh i >> put_ bh s
    

  • compiler/GHC/Tc/Types.hs
    ... ... @@ -569,7 +569,7 @@ data TcGblEnv
    569 569
               -- ^ Allows us to choose unique DFun names.
    
    570 570
     
    
    571 571
             tcg_zany_n :: TcRef Integer,
    
    572
    -          -- ^ A source of unique identities for ZonkAny instances
    
    572
    +          -- ^ A source of unique identities for UnusedType instances
    
    573 573
               -- See Note [Any types] in GHC.Builtin.Types, wrinkle (Any4)
    
    574 574
     
    
    575 575
             tcg_merged :: [(Module, Fingerprint)],
    

  • compiler/GHC/Tc/Utils/Monad.hs
    ... ... @@ -142,7 +142,7 @@ module GHC.Tc.Utils.Monad(
    142 142
       getCCIndexM, getCCIndexTcM,
    
    143 143
     
    
    144 144
       -- * Zonking
    
    145
    -  liftZonkM, newZonkAnyType,
    
    145
    +  liftZonkM, newUnusedType,
    
    146 146
     
    
    147 147
       -- * Complete matches
    
    148 148
       localAndImportedCompleteMatches, getCompleteMatchesTcM,
    
    ... ... @@ -156,7 +156,7 @@ import GHC.Prelude
    156 156
     
    
    157 157
     
    
    158 158
     import GHC.Builtin.Names
    
    159
    -import GHC.Builtin.Types( zonkAnyTyCon )
    
    159
    +import GHC.Builtin.Types( unusedTypeTyCon )
    
    160 160
     
    
    161 161
     import GHC.Tc.Errors.Types
    
    162 162
     import GHC.Tc.Types     -- Re-export all
    
    ... ... @@ -180,7 +180,7 @@ import GHC.Core.UsageEnv
    180 180
     import GHC.Core.Multiplicity
    
    181 181
     import GHC.Core.InstEnv
    
    182 182
     import GHC.Core.FamInstEnv
    
    183
    -import GHC.Core.Type( mkNumLitTy )
    
    183
    +import GHC.Core.Type( mkNumLitTy, mkStrLitTy )
    
    184 184
     
    
    185 185
     import GHC.Driver.Env
    
    186 186
     import GHC.Driver.Session
    
    ... ... @@ -1792,17 +1792,17 @@ chooseUniqueOccTc fn =
    1792 1792
          ; writeTcRef dfun_n_var (extendOccSet set occ)
    
    1793 1793
          ; return occ }
    
    1794 1794
     
    
    1795
    -newZonkAnyType :: Kind -> TcM Type
    
    1796
    --- Return a type (ZonkAny @k n), where n is fresh
    
    1797
    --- Recall  ZonkAny :: forall k. Natural -> k
    
    1795
    +newUnusedType :: Name -> Kind -> TcM Type
    
    1796
    +-- Return a type (UnusedType @k n sym), where n is fresh
    
    1797
    +-- Recall  UnusedType :: forall k. Natural -> Symbol -> k
    
    1798 1798
     -- See Note [Any types] in GHC.Builtin.Types, wrinkle (Any4)
    
    1799
    -newZonkAnyType kind
    
    1799
    +newUnusedType name kind
    
    1800 1800
       = do { env <- getGblEnv
    
    1801 1801
            ; let zany_n_var = tcg_zany_n env
    
    1802 1802
            ; i <- readTcRef zany_n_var
    
    1803 1803
            ; let !i2 = i+1
    
    1804 1804
            ; writeTcRef zany_n_var i2
    
    1805
    -       ; return (mkTyConApp zonkAnyTyCon [kind, mkNumLitTy i]) }
    
    1805
    +       ; return (mkTyConApp unusedTypeTyCon [kind, mkNumLitTy i, mkStrLitTy $ getOccFS name ]) }
    
    1806 1806
     
    
    1807 1807
     getConstraintVar :: TcM (TcRef WantedConstraints)
    
    1808 1808
     getConstraintVar = do { env <- getLclEnv; return (tcl_lie env) }
    

  • compiler/GHC/Tc/Utils/TcType.hs
    ... ... @@ -88,7 +88,7 @@ module GHC.Tc.Utils.TcType (
    88 88
       isSigmaTy, isRhoTy, isRhoExpTy, isOverloadedTy,
    
    89 89
       isFloatingPrimTy, isDoubleTy, isFloatTy, isIntTy, isWordTy, isStringTy,
    
    90 90
       isIntegerTy, isNaturalTy,
    
    91
    -  isBoolTy, isUnitTy, isCharTy,
    
    91
    +  isBoolTy, isUnitTy, isAnyTy, isUnusedTypeTy, isCharTy,
    
    92 92
       isTauTy, isTauTyCon, tcIsTyVarTy,
    
    93 93
       isPredTy, isTyVarClassPred,
    
    94 94
       checkValidClsArgs, hasTyVarHead,
    
    ... ... @@ -2005,7 +2005,7 @@ isFloatTy, isDoubleTy,
    2005 2005
         isFloatPrimTy, isDoublePrimTy,
    
    2006 2006
         isIntegerTy, isNaturalTy,
    
    2007 2007
         isIntTy, isWordTy, isBoolTy,
    
    2008
    -    isUnitTy, isCharTy :: Type -> Bool
    
    2008
    +    isUnitTy, isAnyTy, isUnusedTypeTy, isCharTy :: Type -> Bool
    
    2009 2009
     isFloatTy      = is_tc floatTyConKey
    
    2010 2010
     isDoubleTy     = is_tc doubleTyConKey
    
    2011 2011
     isFloatPrimTy  = is_tc floatPrimTyConKey
    
    ... ... @@ -2016,6 +2016,8 @@ isIntTy = is_tc intTyConKey
    2016 2016
     isWordTy       = is_tc wordTyConKey
    
    2017 2017
     isBoolTy       = is_tc boolTyConKey
    
    2018 2018
     isUnitTy       = is_tc unitTyConKey
    
    2019
    +isAnyTy        = is_tc anyTyConKey
    
    2020
    +isUnusedTypeTy = is_tc unusedTypeTyConKey
    
    2019 2021
     isCharTy       = is_tc charTyConKey
    
    2020 2022
     
    
    2021 2023
     -- | Check whether the type is of the form @Any :: k@,
    

  • compiler/GHC/Tc/Zonk/Type.hs
    1
    +{-# LANGUAGE OverloadedRecordDot #-}
    
    1 2
     {-# LANGUAGE GADTs #-}
    
    2 3
     
    
    3 4
     {-
    
    ... ... @@ -54,7 +55,7 @@ import GHC.Tc.Types.TcRef
    54 55
     import GHC.Tc.TyCl.Build ( TcMethInfo, MethInfo )
    
    55 56
     import GHC.Tc.Utils.Env ( tcLookupGlobalOnly )
    
    56 57
     import GHC.Tc.Utils.TcType
    
    57
    -import GHC.Tc.Utils.Monad ( newZonkAnyType, setSrcSpanA, liftZonkM, traceTc, addErr )
    
    58
    +import GHC.Tc.Utils.Monad ( newUnusedType, setSrcSpanA, liftZonkM, traceTc, addErr )
    
    58 59
     import GHC.Tc.Types.Constraint
    
    59 60
     import GHC.Tc.Types.Evidence
    
    60 61
     import GHC.Tc.Errors.Types
    
    ... ... @@ -471,7 +472,7 @@ commitFlexi tv zonked_kind
    471 472
                | otherwise
    
    472 473
                -> do { traceTc "Defaulting flexi tyvar to ZonkAny:" (pprTyVar tv)
    
    473 474
                        -- See Note [Any types] in GHC.Builtin.Types, esp wrinkle (Any4)
    
    474
    -                 ; newZonkAnyType zonked_kind }
    
    475
    +                 ; newUnusedType name zonked_kind }
    
    475 476
     
    
    476 477
              RuntimeUnkFlexi
    
    477 478
                -> do { traceTc "Defaulting flexi tyvar to RuntimeUnk:" (pprTyVar tv)