Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
e365d496
Commit
e365d496
authored
Sep 10, 2013
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the insolubility check when quantifying
See Note [Quantification with errors] Fixes Trac #8262
parent
dc8b06e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
compiler/typecheck/TcSimplify.lhs
compiler/typecheck/TcSimplify.lhs
+11
-5
No files found.
compiler/typecheck/TcSimplify.lhs
View file @
e365d496
...
@@ -247,8 +247,8 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
...
@@ -247,8 +247,8 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
-- constraint.
-- constraint.
; ev_binds_var <- newTcEvBinds
; ev_binds_var <- newTcEvBinds
; wanted_transformed
<- solveWantedsTcMWithEvBinds ev_binds_var wanteds $
; wanted_transformed
_incl_derivs
solve_wanteds_and_drop
<- solveWantedsTcMWithEvBinds ev_binds_var wanteds solve_wanteds
-- Post: wanted_transformed are zonked
-- Post: wanted_transformed are zonked
-- Step 4) Candidates for quantification are an approximation of wanted_transformed
-- Step 4) Candidates for quantification are an approximation of wanted_transformed
...
@@ -263,9 +263,11 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
...
@@ -263,9 +263,11 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds
; tc_lcl_env <- TcRnMonad.getLclEnv
; tc_lcl_env <- TcRnMonad.getLclEnv
; let untch = tcl_untch tc_lcl_env
; let untch = tcl_untch tc_lcl_env
wanted_transformed = dropDerivedWC wanted_transformed_incl_derivs
; quant_pred_candidates -- Fully zonked
; quant_pred_candidates -- Fully zonked
<- if insolubleWC wanted_transformed
<- if insolubleWC wanted_transformed
_incl_derivs
then return [] -- See Note [Quantification with errors]
then return [] -- See Note [Quantification with errors]
-- NB: must include derived errors
else do { gbl_tvs <- tcGetGlobalTyVars
else do { gbl_tvs <- tcGetGlobalTyVars
; let quant_cand = approximateWC wanted_transformed
; let quant_cand = approximateWC wanted_transformed
meta_tvs = filter isMetaTyVar (varSetElems (tyVarsOfCts quant_cand))
meta_tvs = filter isMetaTyVar (varSetElems (tyVarsOfCts quant_cand))
...
@@ -391,7 +393,11 @@ over, and instead make the function fully-polymorphic in whatever
...
@@ -391,7 +393,11 @@ over, and instead make the function fully-polymorphic in whatever
type we have found. For two reasons
type we have found. For two reasons
a) Minimise downstream errors
a) Minimise downstream errors
b) Avoid spurious errors from this function
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]
Note [Default while Inferring]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
@@ -607,7 +613,7 @@ solveWantedsTcM wanted
...
@@ -607,7 +613,7 @@ solveWantedsTcM wanted
solve_wanteds_and_drop :: WantedConstraints -> TcS (WantedConstraints)
solve_wanteds_and_drop :: WantedConstraints -> TcS (WantedConstraints)
-- Since solve_wanteds returns the residual 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
solve_wanteds_and_drop wanted = do { wc <- solve_wanteds wanted
; return (dropDerivedWC wc) }
; return (dropDerivedWC wc) }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment