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
Denis Frezzato
GHC
Commits
56c26f5e
Commit
56c26f5e
authored
6 years ago
by
Simon Peyton Jones
Committed by
Ben Gamari
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Small refactor
...to use the same error message rather than duplicating it
parent
7b7b338b
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/TcInstDcls.hs
+6
-8
6 additions, 8 deletions
compiler/typecheck/TcInstDcls.hs
with
6 additions
and
8 deletions
compiler/typecheck/TcInstDcls.hs
+
6
−
8
View file @
56c26f5e
...
...
@@ -21,7 +21,7 @@ import TcBinds
import
TcTyClsDecls
import
TcTyDecls
(
addTyConsToGblEnv
)
import
TcClassDcl
(
tcClassDecl2
,
tcATDefault
,
HsSigFun
,
mkHsSigFun
,
HsSigFun
,
mkHsSigFun
,
badMethodErr
,
findMethodBind
,
instantiateMethod
)
import
TcSigs
import
TcRnMonad
...
...
@@ -1539,13 +1539,11 @@ tcMethods dfun_id clas tyvars dfun_ev_vars inst_tys
-- Check if any method bindings do not correspond to the class.
-- See Note [Mismatched class methods and associated type families].
checkMethBindMembership
=
let
bind_nms
=
map
unLoc
$
collectMethodBinders
binds
cls_meth_nms
=
map
(
idName
.
fst
)
op_items
mismatched_meths
=
bind_nms
`
minusList
`
cls_meth_nms
in
forM_
mismatched_meths
$
\
mismatched_meth
->
addErrTc
$
hsep
[
text
"Class"
,
quotes
(
ppr
(
className
clas
))
,
text
"does not have a method"
,
quotes
(
ppr
mismatched_meth
)]
=
mapM_
(
addErrTc
.
badMethodErr
clas
)
mismatched_meths
where
bind_nms
=
map
unLoc
$
collectMethodBinders
binds
cls_meth_nms
=
map
(
idName
.
fst
)
op_items
mismatched_meths
=
bind_nms
`
minusList
`
cls_meth_nms
{-
Note [Mismatched class methods and associated type families]
...
...
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