Simon Peyton Jones pushed to branch wip/T23162-part2 at Glasgow Haskell Compiler / GHC

Commits:

4 changed files:

Changes:

  • compiler/GHC/Tc/Errors.hs
    ... ... @@ -652,13 +652,12 @@ reportWanteds ctxt tc_lvl wc@(WC { wc_simple = simples, wc_impl = implics
    652 652
                   ]
    
    653 653
     
    
    654 654
         -- report2: we suppress these if there are insolubles elsewhere in the tree
    
    655
    -    report2 = [ ("Implicit params", is_ip,           False, mkGroupReporter mkIPErr)
    
    656
    -              , ("Irreds",          is_irred,        False, mkGroupReporter mkIrredErr)
    
    655
    +    report2 = [ ("Irreds",          is_irred,        False, mkGroupReporter mkIrredErr)
    
    657 656
                   , ("Dicts",           is_dict,         False, mkGroupReporter mkDictErr)
    
    658 657
                   , ("Quantified",      is_qc,           False, mkGroupReporter mkQCErr) ]
    
    659 658
     
    
    660 659
         -- rigid_nom_eq, rigid_nom_tv_eq,
    
    661
    -    is_dict, is_equality, is_ip, is_FRR, is_irred :: ErrorItem -> Pred -> Bool
    
    660
    +    is_dict, is_equality, is_FRR, is_irred :: ErrorItem -> Pred -> Bool
    
    662 661
     
    
    663 662
         is_given_eq item pred
    
    664 663
            | Given <- ei_flavour item
    
    ... ... @@ -716,9 +715,6 @@ reportWanteds ctxt tc_lvl wc@(WC { wc_simple = simples, wc_impl = implics
    716 715
         is_dict _ (ClassPred {}) = True
    
    717 716
         is_dict _ _              = False
    
    718 717
     
    
    719
    -    is_ip _ (ClassPred cls _) = isIPClass cls
    
    720
    -    is_ip _ _                 = False
    
    721
    -
    
    722 718
         is_irred _ (IrredPred {}) = True
    
    723 719
         is_irred _ _              = False
    
    724 720
     
    
    ... ... @@ -1687,17 +1683,6 @@ givenConstraints ctxt
    1687 1683
     
    
    1688 1684
     ----------------
    
    1689 1685
     
    
    1690
    -mkIPErr :: SolverReportErrCtxt -> NonEmpty ErrorItem -> TcM SolverReport
    
    1691
    --- What would happen if an item is suppressed because of
    
    1692
    --- Note [Wanteds rewrite Wanteds: rewriter-sets] in GHC.Tc.Types.Constraint?
    
    1693
    --- Very unclear what's best. Let's not worry about this.
    
    1694
    -mkIPErr ctxt (item1:|others)
    
    1695
    -  = do { (ctxt, binds, item1) <- relevantBindings True ctxt item1
    
    1696
    -       ; let msg = important ctxt $ UnboundImplicitParams (item1 :| others)
    
    1697
    -       ; return $ add_relevant_bindings binds msg }
    
    1698
    -
    
    1699
    -----------------
    
    1700
    -
    
    1701 1686
     -- | Report a representation-polymorphism error to the user:
    
    1702 1687
     -- a type is required to have a fixed runtime representation,
    
    1703 1688
     -- but doesn't.
    
    ... ... @@ -2308,7 +2293,15 @@ mkQCErr ctxt items
    2308 2293
     
    
    2309 2294
     
    
    2310 2295
     mkDictErr :: HasDebugCallStack => SolverReportErrCtxt -> NonEmpty ErrorItem -> TcM SolverReport
    
    2311
    -mkDictErr ctxt orig_items
    
    2296
    +-- Includes implict parameters
    
    2297
    +mkDictErr ctxt orig_items@(item1 :| others)
    
    2298
    +  | ClassPred cls tys <- classifyPredType (errorItemPred item1)
    
    2299
    +  , isIPClass cls   -- Implicit parameters; no need to look in global instance envts
    
    2300
    +  = do { (ctxt, binds, item1) <- relevantBindings True ctxt item1
    
    2301
    +       ; let msg = important ctxt $ UnboundImplicitParams (item1 :| others)
    
    2302
    +       ; return $ add_relevant_bindings binds msg }
    
    2303
    +
    
    2304
    +  | otherwise
    
    2312 2305
       = do { inst_envs <- tcGetInstEnvs
    
    2313 2306
            ; let min_items = elim_superclasses items
    
    2314 2307
                  lookups = map (lookup_cls_inst inst_envs) min_items
    
    ... ... @@ -2362,8 +2355,8 @@ mk_dict_err ctxt (item, (matches, pot_unifiers, unsafe_overlapped))
    2362 2355
         { (_, rel_binds, item) <- relevantBindings True ctxt item
    
    2363 2356
         ; candidate_insts <- get_candidate_instances
    
    2364 2357
         ; mb_noBuiltinInst_msg <- getNoBuiltinInstMsg item
    
    2365
    -    ; return $
    
    2366
    -        CannotResolveInstance item unifiers candidate_insts rel_binds mb_noBuiltinInst_msg
    
    2358
    +    ; return $ CannotResolveInstance item unifiers candidate_insts rel_binds
    
    2359
    +                                     mb_noBuiltinInst_msg
    
    2367 2360
         }
    
    2368 2361
     
    
    2369 2362
       -- Some matches => overlap errors
    

  • testsuite/tests/typecheck/should_fail/FunDepOrigin1b.stderr
    1
    -
    
    2 1
     FunDepOrigin1b.hs:9:10: error: [GHC-39999]
    
    3
    -    • No instance for ‘C Bool (Maybe a0)’ arising from a use of ‘op’
    
    2
    +    • No instance for ‘C Bool (Maybe a1)’ arising from a use of ‘op’
    
    4 3
         • In the expression: op True Nothing
    
    5 4
           In the expression: (op True Nothing, op False [])
    
    6 5
           In an equation for ‘foo’: foo _ = (op True Nothing, op False [])
    
    7 6
     
    8
    -FunDepOrigin1b.hs:9:27: error: [GHC-39999]
    
    9
    -    • No instance for ‘C Bool [a1]’ arising from a use of ‘op’
    
    10
    -    • In the expression: op False []
    
    11
    -      In the expression: (op True Nothing, op False [])
    
    12
    -      In an equation for ‘foo’: foo _ = (op True Nothing, op False [])

  • testsuite/tests/typecheck/should_fail/T19415.stderr
    1 1
     T19415.hs:27:8: error: [GHC-39999]
    
    2
    -    • No instance for ‘SetField "name" (Pet a0) (Pet b0) Char’
    
    2
    +    • No instance for ‘SetField "name" (Pet a0) (Pet b) Char’
    
    3 3
             arising from a use of ‘setField’
    
    4 4
         • In the expression: setField @"name" 'c' (Pet "hi")
    
    5 5
           In an equation for ‘loop’: loop = setField @"name" 'c' (Pet "hi")
    

  • testsuite/tests/typecheck/should_fail/T19415b.stderr
    1 1
     T19415b.hs:15:8: error: [GHC-39999]
    
    2
    -    • No instance for ‘Ping (T a0) (T b0) Char’
    
    2
    +    • No instance for ‘Ping (T a0) (T b) Char’
    
    3 3
             arising from a use of ‘foo’
    
    4 4
         • In the expression: foo 'c' MkT
    
    5 5
           In an equation for ‘loop’: loop = foo 'c' MkT