Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
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
Alex D
GHC
Commits
9df82129
Commit
9df82129
authored
Sep 17, 2010
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix overriding of implicit parameters in the solver
parent
ced4c13e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
compiler/typecheck/TcInteract.lhs
compiler/typecheck/TcInteract.lhs
+14
-12
No files found.
compiler/typecheck/TcInteract.lhs
View file @
9df82129
...
...
@@ -709,10 +709,16 @@ doInteractWithInert (CIPCan { cc_id = ipid, cc_flavor = ifl, cc_ip_nm = nm, cc_i
-- so we just generate a fresh coercion variable that isn't used anywhere.
doInteractWithInert (CIPCan { cc_id = id1, cc_flavor = ifl, cc_ip_nm = nm1, cc_ip_ty = ty1 })
workItem@(CIPCan { cc_flavor = wfl, cc_ip_nm = nm2, cc_ip_ty = ty2 })
| nm1 == nm2 && isGiven wfl && isGiven ifl
= -- See Note [Overriding implicit parameters]
-- Dump the inert item, override totally with the new one
-- Do not require type equality
mkIRContinue workItem DropInert emptyCCan
| nm1 == nm2 && ty1 `tcEqType` ty2
= solveOneFromTheOther (id1,ifl) workItem
| nm1 == nm2
&& (not (isGiven ifl && isGiven wfl))
| nm1 == nm2
= -- See Note [When improvement happens]
do { co_var <- newWantedCoVar ty1 ty2
; let flav = Wanted (combineCtLoc ifl wfl)
...
...
@@ -911,20 +917,16 @@ solveOneFromTheOther (iid,ifl) workItem
| isDerived ifl && isDerived wfl
= noInteraction workItem
| wfl `canRewrite` ifl
| ifl `canRewrite` wfl
= do { unless (isGiven wfl) $ setEvBind wid (EvId iid)
-- Overwrite the binding, if one exists
-- For Givens, which are lambda-bound, nothing to overwrite,
; dischargeWorkItem }
| otherwise -- wfl `canRewrite` ifl
= do { unless (isGiven ifl) $ setEvBind iid (EvId wid)
-- Overwrite the binding, if one exists
-- (For Givens, they are lambda-bound so nothing to overwrite,
-- but we still drop the overridden one and replace it in
-- the inert set with the new one
; mkIRContinue workItem DropInert emptyCCan }
-- The order is important here: must do (wfl `canRewrite` ifl) first
-- so that we override the inert item with an inner given if possible.
-- See Note [Overriding implicit parameters]
| otherwise -- ifl `canRewrite` wfl
= do { unless (isGiven wfl) $ setEvBind wid (EvId iid)
; dischargeWorkItem }
where
wfl = cc_flavor workItem
wid = cc_id workItem
...
...
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