Simon Peyton Jones pushed to branch wip/T26868 at Glasgow Haskell Compiler / GHC

Commits:

15 changed files:

Changes:

  • compiler/GHC/Core/Predicate.hs
    ... ... @@ -749,7 +749,12 @@ tyCoVarsOfTypeWellScoped = scopedSort . tyCoVarsOfTypeList
    749 749
     
    
    750 750
     -- | Get the free vars of types in scoped order
    
    751 751
     tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar]
    
    752
    -tyCoVarsOfTypesWellScoped = scopedSort . tyCoVarsOfTypesList
    
    752
    +tyCoVarsOfTypesWellScoped tys
    
    753
    +--  = pprTrace "tyCoVarsOfTypesWellScoped"
    
    754
    +--      (vcat [ ppr tys
    
    755
    +--            , ppr (tyCoVarsOfTypesList tys)
    
    756
    +--            , ppr (scopedSort (tyCoVarsOfTypesList tys)) ]) $
    
    757
    +  = scopedSort (tyCoVarsOfTypesList tys)
    
    753 758
     
    
    754 759
     
    
    755 760
     {- *********************************************************************
    

  • compiler/GHC/Tc/Errors.hs
    ... ... @@ -2024,6 +2024,12 @@ mkTyVarEqErr' ctxt item tv1 ty2
    2024 2024
                    { mismatchMsg       = headline_msg
    
    2025 2025
                    , cannotUnifyReason = occurs_err }
    
    2026 2026
     
    
    2027
    +--       pprTrace "mkTyVarEqErr" (vcat
    
    2028
    +--          [ text "interesting" <+> pprTyVars interesting_tyvars
    
    2029
    +--          , text "tv1" <+> ppr tv1
    
    2030
    +--          , text "free tvs1" <+> pprTyVars (tyCoVarsOfTypeList ty1)
    
    2031
    +--          , text "ty2" <+> ppr ty2
    
    2032
    +--          , text "free tvs2" <+> pprTyVars (tyCoVarsOfTypeList ty2) ]) $
    
    2027 2033
            return main_msg
    
    2028 2034
     
    
    2029 2035
       -- If the immediately-enclosing implication has 'tv' a skolem, and
    

  • testsuite/tests/count-deps/CountDepsAst.stdout
    ... ... @@ -192,6 +192,7 @@ GHC.Types.Unique.Set
    192 192
     GHC.Types.Unique.Supply
    
    193 193
     GHC.Types.Var
    
    194 194
     GHC.Types.Var.Env
    
    195
    +GHC.Types.Var.FV
    
    195 196
     GHC.Types.Var.Set
    
    196 197
     GHC.Unit
    
    197 198
     GHC.Unit.Home
    
    ... ... @@ -218,7 +219,6 @@ GHC.Utils.Containers.Internal.StrictPair
    218 219
     GHC.Utils.EndoOS
    
    219 220
     GHC.Utils.Error
    
    220 221
     GHC.Utils.Exception
    
    221
    -GHC.Utils.FV
    
    222 222
     GHC.Utils.Fingerprint
    
    223 223
     GHC.Utils.GlobalVars
    
    224 224
     GHC.Utils.IO.Unsafe
    

  • testsuite/tests/count-deps/CountDepsParser.stdout
    ... ... @@ -217,6 +217,7 @@ GHC.Types.Unique.Set
    217 217
     GHC.Types.Unique.Supply
    
    218 218
     GHC.Types.Var
    
    219 219
     GHC.Types.Var.Env
    
    220
    +GHC.Types.Var.FV
    
    220 221
     GHC.Types.Var.Set
    
    221 222
     GHC.Unit
    
    222 223
     GHC.Unit.Home
    
    ... ... @@ -247,7 +248,6 @@ GHC.Utils.Containers.Internal.StrictPair
    247 248
     GHC.Utils.EndoOS
    
    248 249
     GHC.Utils.Error
    
    249 250
     GHC.Utils.Exception
    
    250
    -GHC.Utils.FV
    
    251 251
     GHC.Utils.Fingerprint
    
    252 252
     GHC.Utils.GlobalVars
    
    253 253
     GHC.Utils.IO.Unsafe
    

  • testsuite/tests/cpranal/should_compile/T18401.stderr
    1 1
     
    
    2 2
     ==================== Tidy Core ====================
    
    3
    -Result size of Tidy Core = {terms: 58, types: 93, coercions: 0, joins: 1/1}
    
    3
    +Result size of Tidy Core = {terms: 52, types: 86, coercions: 0, joins: 0/0}
    
    4 4
     
    
    5 5
     Rec {
    
    6 6
     -- RHS size: {terms: 18, types: 24, coercions: 0, joins: 0/0}
    
    7
    -T18401.$w$spoly_$wgo1 :: forall a. a -> [a] -> (# [a] #)
    
    7
    +T18401.$w$spoly_$wgo1 :: forall a. [a] -> a -> (# [a] #)
    
    8 8
     T18401.$w$spoly_$wgo1
    
    9
    -  = \ (@a_s1eu) (sc_s1ev :: a_s1eu) (sc1_s1ew :: [a_s1eu]) ->
    
    10
    -      case sc1_s1ew of {
    
    11
    -        [] -> (# GHC.Types.[] @a_s1eu #);
    
    12
    -        : y_a1dy ys_a1dz -> (# GHC.Types.: @a_s1eu sc_s1ev (case T18401.$w$spoly_$wgo1 @a_s1eu y_a1dy ys_a1dz of { (# ww_s1eA #) -> ww_s1eA }) #)
    
    9
    +  = \ (@a_s1fk) (sc_s1fl :: [a_s1fk]) (sc1_s1fm :: a_s1fk) ->
    
    10
    +      case sc_s1fl of {
    
    11
    +        [] -> (# GHC.Internal.Types.[] @a_s1fk #);
    
    12
    +        : y_a1eg ys_a1eh -> (# GHC.Internal.Types.: @a_s1fk sc1_s1fm (case T18401.$w$spoly_$wgo1 @a_s1fk ys_a1eh y_a1eg of { (# ww_s1fr #) -> ww_s1fr }) #)
    
    13 13
           }
    
    14 14
     end Rec }
    
    15 15
     
    
    16
    --- RHS size: {terms: 23, types: 29, coercions: 0, joins: 1/1}
    
    16
    +-- RHS size: {terms: 17, types: 22, coercions: 0, joins: 0/0}
    
    17 17
     si :: forall a. [a] -> (Bool, [a])
    
    18 18
     si
    
    19
    -  = \ (@a_s1dI) (xs0_s1dJ :: [a_s1dI]) ->
    
    20
    -      join {
    
    21
    -        $j_s1eq :: Bool %1 -> [a_s1dI] %1 -> (Bool, [a_s1dI])
    
    22
    -        $j_s1eq (ww_s1dX :: Bool) (ww1_s1dY :: [a_s1dI]) = (ww_s1dX, ww1_s1dY) } in
    
    23
    -      case xs0_s1dJ of {
    
    24
    -        [] -> jump $j_s1eq GHC.Types.False (GHC.Types.[] @a_s1dI);
    
    25
    -        : y_a1dy ys_a1dz -> jump $j_s1eq GHC.Types.True (case T18401.$w$spoly_$wgo1 @a_s1dI y_a1dy ys_a1dz of { (# ww_s1eA #) -> ww_s1eA })
    
    19
    +  = \ (@a_s1er) (xs0_s1es :: [a_s1er]) ->
    
    20
    +      case xs0_s1es of {
    
    21
    +        [] -> (GHC.Internal.Types.False, GHC.Internal.Types.[] @a_s1er);
    
    22
    +        : y_a1eg ys_a1eh -> (GHC.Internal.Types.True, case T18401.$w$spoly_$wgo1 @a_s1er ys_a1eh y_a1eg of { (# ww_s1fr #) -> ww_s1fr })
    
    26 23
           }
    
    27 24
     
    
    28 25
     -- RHS size: {terms: 14, types: 19, coercions: 0, joins: 0/0}
    
    29 26
     safeInit :: forall a. [a] -> Maybe [a]
    
    30 27
     safeInit
    
    31
    -  = \ (@a_aQY) (xs_awU :: [a_aQY]) ->
    
    32
    -      case xs_awU of {
    
    33
    -        [] -> GHC.Internal.Maybe.Nothing @[a_aQY];
    
    34
    -        : y_a1dy ys_a1dz -> GHC.Internal.Maybe.Just @[a_aQY] (case T18401.$w$spoly_$wgo1 @a_aQY y_a1dy ys_a1dz of { (# ww_s1eA #) -> ww_s1eA })
    
    28
    +  = \ (@a_aUv) (xs_ax5 :: [a_aUv]) ->
    
    29
    +      case xs_ax5 of {
    
    30
    +        [] -> GHC.Internal.Maybe.Nothing @[a_aUv];
    
    31
    +        : y_a1eg ys_a1eh -> GHC.Internal.Maybe.Just @[a_aUv] (case T18401.$w$spoly_$wgo1 @a_aUv ys_a1eh y_a1eg of { (# ww_s1fr #) -> ww_s1fr })
    
    35 32
           }
    
    36 33
     
    
    37 34
     
    

  • testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
    ... ... @@ -5,13 +5,13 @@ deriving-via-fail4.hs:15:12: error: [GHC-18872]
    5 5
         • When deriving the instance for (Eq F1)
    
    6 6
     
    
    7 7
     deriving-via-fail4.hs:18:13: error: [GHC-25897]
    
    8
    -    • Couldn't match representation of type ‘a2’ with that of ‘a1’
    
    8
    +    • Couldn't match representation of type ‘a1’ with that of ‘a2’
    
    9 9
             arising from the coercion of the method ‘c’
    
    10 10
               from type ‘a -> a -> Bool’ to type ‘a -> F2 a1 -> Bool’
    
    11
    -      ‘a2’ is a rigid type variable bound by
    
    11
    +      ‘a1’ is a rigid type variable bound by
    
    12 12
             the deriving clause for ‘C a (F2 a1)’
    
    13 13
             at deriving-via-fail4.hs:18:13-15
    
    14
    -      ‘a1’ is a rigid type variable bound by
    
    14
    +      ‘a2’ is a rigid type variable bound by
    
    15 15
             the deriving clause for ‘C a (F2 a1)’
    
    16 16
             at deriving-via-fail4.hs:18:13-15
    
    17 17
         • When deriving the instance for (C a (F2 a1))
    

  • testsuite/tests/indexed-types/should_fail/T2693.stderr
    1 1
     T2693.hs:12:15: error: [GHC-83865]
    
    2
    -    • Couldn't match expected type: (a8, b1)
    
    2
    +    • Couldn't match expected type: (a7, b1)
    
    3 3
                       with actual type: TFn a6
    
    4 4
           The type variable ‘a6’ is ambiguous
    
    5 5
         • In the first argument of ‘fst’, namely ‘x’
    
    6 6
           In the first argument of ‘(+)’, namely ‘fst x’
    
    7 7
           In the expression: fst x + fst x
    
    8
    -    • Relevant bindings include n :: a8 (bound at T2693.hs:12:7)
    
    8
    +    • Relevant bindings include n :: a7 (bound at T2693.hs:12:7)
    
    9 9
     
    
    10 10
     T2693.hs:12:23: error: [GHC-83865]
    
    11
    -    • Couldn't match expected type: (a8, b2)
    
    12
    -                  with actual type: TFn a7
    
    13
    -      The type variable ‘a7’ is ambiguous
    
    11
    +    • Couldn't match expected type: (a7, b2)
    
    12
    +                  with actual type: TFn a8
    
    13
    +      The type variable ‘a8’ is ambiguous
    
    14 14
         • In the first argument of ‘fst’, namely ‘x’
    
    15 15
           In the second argument of ‘(+)’, namely ‘fst x’
    
    16 16
           In the expression: fst x + fst x
    
    17
    -    • Relevant bindings include n :: a8 (bound at T2693.hs:12:7)
    
    17
    +    • Relevant bindings include n :: a7 (bound at T2693.hs:12:7)
    
    18 18
     
    
    19 19
     T2693.hs:19:15: error: [GHC-83865]
    
    20
    -    • Couldn't match expected type: (a5, b0)
    
    20
    +    • Couldn't match expected type: (a3, b0)
    
    21 21
                       with actual type: TFn a2
    
    22 22
           The type variable ‘a2’ is ambiguous
    
    23 23
         • In the first argument of ‘fst’, namely ‘x’
    
    24 24
           In the first argument of ‘(+)’, namely ‘fst x’
    
    25 25
           In the expression: fst x + snd x
    
    26
    -    • Relevant bindings include n :: a5 (bound at T2693.hs:19:7)
    
    26
    +    • Relevant bindings include n :: a3 (bound at T2693.hs:19:7)
    
    27 27
     
    
    28 28
     T2693.hs:19:23: error: [GHC-83865]
    
    29
    -    • Couldn't match expected type: (a4, a5)
    
    30
    -                  with actual type: TFn a3
    
    31
    -      The type variable ‘a3’ is ambiguous
    
    29
    +    • Couldn't match expected type: (a5, a3)
    
    30
    +                  with actual type: TFn a4
    
    31
    +      The type variable ‘a4’ is ambiguous
    
    32 32
         • In the first argument of ‘snd’, namely ‘x’
    
    33 33
           In the second argument of ‘(+)’, namely ‘snd x’
    
    34 34
           In the expression: fst x + snd x
    
    35
    -    • Relevant bindings include n :: a5 (bound at T2693.hs:19:7)
    
    35
    +    • Relevant bindings include n :: a3 (bound at T2693.hs:19:7)
    
    36 36
     
    
    37 37
     T2693.hs:29:20: error: [GHC-83865]
    
    38 38
         • Couldn't match type: TFn a0
    

  • testsuite/tests/partial-sigs/should_compile/T10403.stderr
    ... ... @@ -7,14 +7,14 @@ T10403.hs:16:7: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    7 7
     
    
    8 8
     T10403.hs:16:12: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    9 9
         • Found type wildcard ‘_’ standing for ‘(t -> b) -> f t -> H f’
    
    10
    -      Where: ‘b’, ‘t’, ‘f’ are rigid type variables bound by
    
    10
    +      Where: ‘t’, ‘b’, ‘f’ are rigid type variables bound by
    
    11 11
                    the inferred type of h1 :: Functor f => (t -> b) -> f t -> H f
    
    12 12
                    at T10403.hs:18:1-41
    
    13 13
         • In the type signature: h1 :: _ => _
    
    14 14
     
    
    15 15
     T10403.hs:20:7: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    16 16
         • Found type wildcard ‘_’ standing for ‘(t -> b) -> f t -> H f’
    
    17
    -      Where: ‘b’, ‘t’, ‘f’ are rigid type variables bound by
    
    17
    +      Where: ‘t’, ‘b’, ‘f’ are rigid type variables bound by
    
    18 18
                    the inferred type of h2 :: (t -> b) -> f t -> H f
    
    19 19
                    at T10403.hs:23:1-41
    
    20 20
         • In the type signature: h2 :: _
    

  • testsuite/tests/partial-sigs/should_compile/T12844.stderr
    1
    -
    
    2 1
     T12844.hs:12:9: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    3 2
         • Found extra-constraints wildcard standing for
    
    4 3
             ‘(Head rngs ~ '(r, r'), Foo rngs)’
    
    5
    -      Where: ‘r’, ‘r'’, ‘k1’, ‘k2’, ‘rngs’
    
    4
    +      Where: ‘k1’, ‘k2’, ‘rngs’, ‘r’, ‘r'’
    
    6 5
                    are rigid type variables bound by
    
    7 6
                    the inferred type of
    
    8 7
                      bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs
    
    9 8
                    at T12844.hs:(12,1)-(13,9)
    
    10 9
         • In the type signature: bar :: _ => FooData rngs
    
    10
    +

  • testsuite/tests/partial-sigs/should_compile/T15039a.stderr
    1
    -
    
    2 1
     T15039a.hs:19:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    3 2
         • Found type wildcard ‘_’ standing for ‘Dict (a ~ b)’
    
    4 3
           Where: ‘a’, ‘b’ are rigid type variables bound by
    
    ... ... @@ -25,7 +24,7 @@ T15039a.hs:22:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)
    25 24
     
    
    26 25
     T15039a.hs:25:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    27 26
         • Found type wildcard ‘_’ standing for ‘Dict (a ~~ b)’
    
    28
    -      Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by
    
    27
    +      Where: ‘k’, ‘a’, ‘b’ are rigid type variables bound by
    
    29 28
                    the type signature for:
    
    30 29
                      ex3 :: forall a k (b :: k). Dict (a ~~ b) -> ()
    
    31 30
                    at T15039a.hs:24:1-43
    
    ... ... @@ -54,3 +53,4 @@ T15039a.hs:35:8: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    54 53
                    at T15039a.hs:35:1-44
    
    55 54
         • In the type signature:
    
    56 55
             ex7 :: _ => Coercion (a :: Type) (b :: Type)
    
    56
    +

  • testsuite/tests/partial-sigs/should_compile/T15039b.stderr
    1
    -
    
    2 1
     T15039b.hs:19:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    3 2
         • Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~ (b :: *))’
    
    4 3
           Where: ‘a’, ‘b’ are rigid type variables bound by
    
    ... ... @@ -26,7 +25,7 @@ T15039b.hs:22:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)
    26 25
     T15039b.hs:25:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    27 26
         • Found type wildcard ‘_’
    
    28 27
             standing for ‘Dict ((a :: *) ~~ (b :: k))’
    
    29
    -      Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by
    
    28
    +      Where: ‘k’, ‘a’, ‘b’ are rigid type variables bound by
    
    30 29
                    the type signature for:
    
    31 30
                      ex3 :: forall a k (b :: k). Dict ((a :: *) ~~ (b :: k)) -> ()
    
    32 31
                    at T15039b.hs:24:1-43
    
    ... ... @@ -56,3 +55,4 @@ T15039b.hs:35:8: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    56 55
                    at T15039b.hs:35:1-44
    
    57 56
         • In the type signature:
    
    58 57
             ex7 :: _ => Coercion (a :: Type) (b :: Type)
    
    58
    +

  • testsuite/tests/partial-sigs/should_compile/T15039c.stderr
    1
    -
    
    2 1
     T15039c.hs:19:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    3 2
         • Found type wildcard ‘_’ standing for ‘Dict (a ~ b)’
    
    4 3
           Where: ‘a’, ‘b’ are rigid type variables bound by
    
    ... ... @@ -25,7 +24,7 @@ T15039c.hs:22:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)
    25 24
     
    
    26 25
     T15039c.hs:25:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    27 26
         • Found type wildcard ‘_’ standing for ‘Dict (a ~~ b)’
    
    28
    -      Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by
    
    27
    +      Where: ‘k’, ‘a’, ‘b’ are rigid type variables bound by
    
    29 28
                    the type signature for:
    
    30 29
                      ex3 :: forall a k (b :: k). Dict (a ~~ b) -> ()
    
    31 30
                    at T15039c.hs:24:1-43
    
    ... ... @@ -54,3 +53,4 @@ T15039c.hs:35:8: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    54 53
                    at T15039c.hs:35:1-44
    
    55 54
         • In the type signature:
    
    56 55
             ex7 :: _ => Coercion (a :: Type) (b :: Type)
    
    56
    +

  • testsuite/tests/partial-sigs/should_compile/T15039d.stderr
    1
    -
    
    2 1
     T15039d.hs:19:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    3 2
         • Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~ (b :: *))’
    
    4 3
           Where: ‘a’, ‘b’ are rigid type variables bound by
    
    ... ... @@ -27,7 +26,7 @@ T15039d.hs:22:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)
    27 26
     T15039d.hs:25:14: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    
    28 27
         • Found type wildcard ‘_’
    
    29 28
             standing for ‘Dict ((a :: *) ~~ (b :: k))’
    
    30
    -      Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by
    
    29
    +      Where: ‘k’, ‘a’, ‘b’ are rigid type variables bound by
    
    31 30
                    the type signature for:
    
    32 31
                      ex3 :: forall a k (b :: k). Dict ((a :: *) ~~ (b :: k)) -> ()
    
    33 32
                    at T15039d.hs:24:1-43
    
    ... ... @@ -57,3 +56,4 @@ T15039d.hs:35:8: warning: [GHC-88464] [-Wpartial-type-signatures (in -Wdefault)]
    57 56
                    at T15039d.hs:35:1-44
    
    58 57
         • In the type signature:
    
    59 58
             ex7 :: _ => Coercion (a :: Type) (b :: Type)
    
    59
    +

  • testsuite/tests/partial-sigs/should_fail/T10999.stderr
    ... ... @@ -15,10 +15,10 @@ T10999.hs:5:17: error: [GHC-88464]
    15 15
         • In the type signature: f :: _ => () -> _
    
    16 16
     
    
    17 17
     T10999.hs:8:28: error: [GHC-39999]
    
    18
    -    • Ambiguous type variable ‘b1’ arising from a use of ‘f’
    
    19
    -      prevents the constraint ‘(Ord b1)’ from being solved.
    
    20
    -      Relevant bindings include g :: [b1] (bound at T10999.hs:8:1)
    
    21
    -      Probable fix: use a type annotation to specify what ‘b1’ should be.
    
    18
    +    • Ambiguous type variable ‘b0’ arising from a use of ‘f’
    
    19
    +      prevents the constraint ‘(Ord b0)’ from being solved.
    
    20
    +      Relevant bindings include g :: [b0] (bound at T10999.hs:8:1)
    
    21
    +      Probable fix: use a type annotation to specify what ‘b0’ should be.
    
    22 22
           Potentially matching instances:
    
    23 23
             instance Ord a => Ord (Set.Intersection a)
    
    24 24
               -- Defined in ‘Data.Set.Internal’
    

  • testsuite/tests/partial-sigs/should_fail/T12634.stderr
    1
    -
    
    2 1
     T12634.hs:15:58: error: [GHC-83865]
    
    3 2
         • Expected a type,
    
    4 3
           but ‘'(t, m, m', r)’ has kind
    
    5
    -      ‘(k1 -> k2 -> *, k0, k1, k2)’
    
    4
    +      ‘(k0 -> k1 -> *, k2, k0, k1)’
    
    6 5
         • In the first argument of ‘Bench’, namely ‘'(t, m, m', r)’
    
    7 6
           In the type signature:
    
    8 7
             bench_twacePow :: forall t m m' r. _ =>
    
    9 8
                                                t m' r -> Bench '(t, m, m', r)
    
    9
    +