Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Finn Teegen
curry-frontend
Commits
af8a53c6
Commit
af8a53c6
authored
Oct 24, 2013
by
Matthias Böhm
Browse files
on type error in class method implementations: display *original name* and *original position*
parent
81130d28
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Checks/TypeCheck.lhs
View file @
af8a53c6
...
...
@@ -1147,7 +1147,7 @@ the maximal necessary contexts for the functions are determined.
>
unifyDecl
::
Decl
->
ConstrType
->
ConstrType
->
TCM
()
>
unifyDecl
(
FunctionDecl
p
_
_
f
_
)
=
>
unify
p
"function binding"
(
text
"Function:"
<+>
ppIdent
f
)
>
unify
p
"function binding"
(
text
"Function:"
<+>
ppIdent
(
extractOrigName
f
)
)
>
unifyDecl
(
PatternDecl
p
_
_
t
_
)
=
>
unify
p
"pattern binding"
(
ppPattern
0
t
)
>
unifyDecl
_
=
internalError
"TypeCheck.unifyDecl: no pattern match"
...
...
src/Checks/TypeClassesCheck.hs
View file @
af8a53c6
...
...
@@ -1181,9 +1181,9 @@ transformClass2 mdl cEnv tcEnv (ClassDecl p _scx cls _tyvar _decls) =
-- |Generates a top-level function containing the implementation of the
-- default implementation given in the class declaration
genDefaultMethod
::
Decl
->
[
Decl
]
genDefaultMethod
(
FunctionDecl
_
p
cty
n
f
eqs
)
=
TypeSig
p
True
[
rename
toTopLevel
f
]
cx
ty'
:
[
FunctionDecl
p
cty
n
(
rename
toTopLevel
f
)
(
map
(
transEqu
zeroArity
toTopLevel
)
eqs
)]
genDefaultMethod
(
FunctionDecl
p
'
cty
n
f
eqs
)
=
TypeSig
p
'
True
[
rename
toTopLevel
f
]
cx
ty'
:
[
FunctionDecl
p
'
cty
n
(
rename
toTopLevel
f
)
(
map
(
transEqu
zeroArity
toTopLevel
)
eqs
)]
where
(
cx0
,
ty
)
=
fromJust
$
canonLookupMethodTypeSig'
cEnv
(
theClass
theClass0
)
f
cx
=
combineContexts
cx0
...
...
test/typeclasses/modules/TypeErrors.curry
0 → 100644
View file @
af8a53c6
class C a where
funC :: a -> Int
funC x = 'c'
instance C Bool where
funC True = 'c'
test :: Int -> Char
test 'c' = 1::Int
test2 :: Int -> Char
test2 1 = 'c'
instance C Int where
funC x = (1::Int) == '2'
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment