Commit d66ca011 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

typecheck: Don't warn about "redundant" TypeError constraints

Summary: This fixes #15232, where we would warn about `TypeError` constraints being redundant.

Test Plan: Validate

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15232

Differential Revision: https://phabricator.haskell.org/D4808
parent 297879a7
......@@ -459,9 +459,14 @@ warnRedundantConstraints ctxt env info ev_vars
doc = text "Redundant constraint" <> plural redundant_evs <> colon
<+> pprEvVarTheta redundant_evs
redundant_evs = case info of -- See Note [Redundant constraints in instance decls]
InstSkol -> filterOut improving ev_vars
_ -> ev_vars
redundant_evs =
filterOut is_type_error $
case info of -- See Note [Redundant constraints in instance decls]
InstSkol -> filterOut improving ev_vars
_ -> ev_vars
-- See #15232
is_type_error = isJust . userTypeError_maybe . idType
improving ev_var = any isImprovementPred $
transSuperClasses (idType ev_var)
......
......@@ -621,5 +621,4 @@ test('SplitWD', normal, compile, [''])
test('T14441', omit_ways(['profasm']), compile, [''])
test('T15050', [expect_broken(15050)], compile, [''])
test('T14735', normal, compile, [''])
test('T15232', expect_broken(15232), compile, [''])
test('T15232', normal, compile, [''])
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