Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gershomb
GHC
Commits
e365d496
Commit
e365d496
authored
11 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
Improve the insolubility check when quantifying
See Note [Quantification with errors] Fixes Trac #8262
parent
dc8b06e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/typecheck/TcSimplify.lhs
+11
-5
11 additions, 5 deletions
compiler/typecheck/TcSimplify.lhs
with
11 additions
and
5 deletions
compiler/typecheck/TcSimplify.lhs
+
11
−
5
View file @
e365d496
...
...
@@ -247,8 +247,8 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
-- constraint.
; ev_binds_var <- newTcEvBinds
; wanted_transformed
<- solveWantedsTcMWithEvBinds ev_binds_var wanted
s
$
solve
_w
anteds
_and_drop
; wanted_transformed
_incl_deriv
s
<-
solve
W
anteds
TcMWithEvBinds ev_binds_var wanteds solve_wanteds
-- Post: wanted_transformed are zonked
-- Step 4) Candidates for quantification are an approximation of wanted_transformed
...
...
@@ -263,9 +263,11 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
; tc_lcl_env <- TcRnMonad.getLclEnv
; let untch = tcl_untch tc_lcl_env
wanted_transformed = dropDerivedWC wanted_transformed_incl_derivs
; quant_pred_candidates -- Fully zonked
<- if insolubleWC wanted_transformed
<- if insolubleWC wanted_transformed
_incl_derivs
then return [] -- See Note [Quantification with errors]
-- NB: must include derived errors
else do { gbl_tvs <- tcGetGlobalTyVars
; let quant_cand = approximateWC wanted_transformed
meta_tvs = filter isMetaTyVar (varSetElems (tyVarsOfCts quant_cand))
...
...
@@ -391,7 +393,11 @@ over, and instead make the function fully-polymorphic in whatever
type we have found. For two reasons
a) Minimise downstream errors
b) Avoid spurious errors from this function
But NB that we must include *derived* errors in the check. Example:
(a::*) ~ Int#
We get an insoluble derived error *~#, and we don't want to discard
it before doing the isInsolubleWC test! (Trac #8262)
Note [Default while Inferring]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -607,7 +613,7 @@ solveWantedsTcM wanted
solve_wanteds_and_drop :: WantedConstraints -> TcS (WantedConstraints)
-- Since solve_wanteds returns the residual WantedConstraints,
-- it should alway be called within a runTcS or something similar,
-- it should alway
s
be called within a runTcS or something similar,
solve_wanteds_and_drop wanted = do { wc <- solve_wanteds wanted
; return (dropDerivedWC wc) }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment