Commit af8a53c6 authored by Matthias Böhm's avatar Matthias Böhm
Browse files

on type error in class method implementations: display *original name* and *original position*

parent 81130d28
......@@ -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"
......
......@@ -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
......
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'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment