Commit 2dc5b92e authored by niteria's avatar niteria
Browse files

Kill varSetElems in TcErrors

The uses of varSetElems in these places are unnecessary and while it
doesn't intruduce non-determinism in the ABI the plan is to get
rid of all varSetElems to get some compile time guarantees.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2141

GHC Trac Issues: #4012
parent 0712f556
......@@ -52,6 +52,7 @@ import StaticFlags ( opt_PprStyle_Debug )
import ListSetOps ( equivClasses )
import Maybes
import qualified GHC.LanguageExtensions as LangExt
import FV ( fvVarList, unionFV )
import Control.Monad ( when )
import Data.List ( partition, mapAccumL, nub, sortBy )
......@@ -177,7 +178,7 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes type_holes wante
free_tvs = tyCoVarsOfWC wanted
; traceTc "reportUnsolved (after zonking and tidying):" $
vcat [ pprTvBndrs (varSetElems free_tvs)
vcat [ pprVarSet pprTvBndrs free_tvs
, ppr wanted ]
; warn_redundant <- woptM Opt_WarnRedundantConstraints
......@@ -1337,8 +1338,8 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2
interesting_tyvars
= filter (not . isEmptyVarSet . tyCoVarsOfType . tyVarKind) $
filter isTyVar $
varSetElems $
tyCoVarsOfType ty1 `unionVarSet` tyCoVarsOfType ty2
fvVarList $
tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2
extra3 = relevant_bindings $
ppWhen (not (null interesting_tyvars)) $
hang (text "Type variable kinds:") 2 $
......@@ -2457,10 +2458,9 @@ getAmbigTkvs :: Ct -> ([Var],[Var])
getAmbigTkvs ct
= partition (`elemVarSet` dep_tkv_set) ambig_tkvs
where
tkv_set = tyCoVarsOfCt ct
ambig_tkv_set = filterVarSet isAmbiguousTyVar tkv_set
dep_tkv_set = tyCoVarsOfTypes (map tyVarKind (varSetElems tkv_set))
ambig_tkvs = varSetElems ambig_tkv_set
tkvs = tyCoVarsOfCtList ct
ambig_tkvs = filter isAmbiguousTyVar tkvs
dep_tkv_set = tyCoVarsOfTypes (map tyVarKind tkvs)
getSkolemInfo :: [Implication] -> TcTyVar -> ([TcTyVar], SkolemInfo)
-- Get the skolem info for a type variable
......
......@@ -4,5 +4,5 @@ T11407.hs:10:40: error:
• In the second argument of ‘UhOh’, namely ‘(a :: x a)’
In the data instance declaration for ‘UhOh’
• Type variable kinds:
a :: k0
x :: k0 -> *
a :: k0
T2693.hs:12:15: error:
• Couldn't match expected type ‘(a8, b1)’ with actual type ‘TFn a6’
The type variables ‘b1’, ‘a6’, ‘a8’ are ambiguous
The type variables ‘a6’, ‘a8’, ‘b1’ are ambiguous
• In the first argument of ‘fst’, namely ‘x’
In the first argument of ‘(+)’, namely ‘fst x’
In the expression: fst x + fst x
......@@ -9,7 +9,7 @@ T2693.hs:12:15: error:
T2693.hs:12:23: error:
• Couldn't match expected type ‘(a8, b2)’ with actual type ‘TFn a7’
The type variables ‘b2’, ‘a7’, ‘a8’ are ambiguous
The type variables ‘a7’, ‘a8’, ‘b2’ are ambiguous
• In the first argument of ‘fst’, namely ‘x’
In the second argument of ‘(+)’, namely ‘fst x’
In the expression: fst x + fst x
......@@ -17,7 +17,7 @@ T2693.hs:12:23: error:
T2693.hs:19:15: error:
• Couldn't match expected type ‘(a5, b0)’ with actual type ‘TFn a2’
The type variables ‘b0’, ‘a2’, ‘a5’ are ambiguous
The type variables ‘a2’, ‘a5’, ‘b0’ are ambiguous
• In the first argument of ‘fst’, namely ‘x’
In the first argument of ‘(+)’, namely ‘fst x’
In the expression: fst x + snd x
......@@ -25,7 +25,7 @@ T2693.hs:19:15: error:
T2693.hs:19:23: error:
• Couldn't match expected type ‘(a3, a5)’ with actual type ‘TFn a4’
The type variables ‘a3’, ‘a4’, ‘a5’ are ambiguous
The type variables ‘a4’, ‘a3’, ‘a5’ are ambiguous
• In the first argument of ‘snd’, namely ‘x’
In the second argument of ‘(+)’, namely ‘snd x’
In the expression: fst x + snd x
......
T4921.hs:10:9: error:
Ambiguous type variables ‘b1’, ‘a0’ arising from a use of ‘f’
prevents the constraint ‘(C a0 b1)’ from being solved.
Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
Probable fix: use a type annotation to specify what ‘b1’, ‘a0’ should be.
These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f
In an equation for ‘x’: x = fst f
Ambiguous type variables ‘a0’, ‘b1’ arising from a use of ‘f’
prevents the constraint ‘(C a0 b1)’ from being solved.
Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
Probable fix: use a type annotation to specify what ‘a0’, ‘b1’ should be.
These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f
In an equation for ‘x’: x = fst f
T4921.hs:12:9: error:
Ambiguous type variable ‘b0’ arising from a use of ‘f’
prevents the constraint ‘(C Int b0)’ from being solved.
Probable fix: use a type annotation to specify what ‘b0’ should be.
These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f :: Int
In an equation for ‘y’: y = fst f :: Int
Ambiguous type variable ‘b0’ arising from a use of ‘f’
prevents the constraint ‘(C Int b0)’ from being solved.
Probable fix: use a type annotation to specify what ‘b0’ should be.
These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f :: Int
In an equation for ‘y’: y = fst f :: Int
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment