@@ -1262,7 +1262,7 @@ elabClass info syn doc fc constraints tn ps ds
1262 -- allow dependent type classes, but building instances will
1262 -- allow dependent type classes, but building instances will
1263 -- then need some attention.
1263 -- then need some attention.
1264 let cty = impbind ps $ conbind constraints
1264 let cty = impbind ps $ conbind constraints
1265− $ pibind (map (\ (n, ty) -> (mdec n, ty)) methods)
1265+ $ pibind (map (\ (n, ty) -> (nsroot n, ty)) methods)
1266 constraint
1266 constraint
1267 let cons = [("", cn, cty, fc)]
1267 let cons = [("", cn, cty, fc)]
1268 let ddecl = PDatadecl tn tty cons
1268 let ddecl = PDatadecl tn tty cons
@@ -1427,11 +1427,15 @@ elabInstance info syn fc cs n ps t expn ds
1427 PApp _ _ args -> getWParams args
1427 PApp _ _ args -> getWParams args
1428 _ -> return []) ps
1428 _ -> return []) ps
1429 let pnames = map pname (concat (nub wparams))
1429 let pnames = map pname (concat (nub wparams))
1430+ let all_meths = map (nsroot . fst) (class_methods ci)
1430 let mtys = map (\ (n, (op, t)) ->
1431 let mtys = map (\ (n, (op, t)) ->
1431− let t' = substMatchesShadow ips pnames t in
1432+ let t_in = substMatchesShadow ips pnames t
1433+ mnamemap = map (\n -> (n, PRef fc (decorate ns iname n)))
1435+ t' = substMatchesShadow mnamemap pnames t_in in
1432− (decorate ns iname n,
1436+ (decorate ns iname n,
1433− op, coninsert cs t', t'))
1437+ op, coninsert cs t', t'))
1434− (class_methods ci)
1438+ (class_methods ci)
1435 logLvl 3 (show (mtys, ips))
1439 logLvl 3 (show (mtys, ips))
1436 let ds' = insertDefaults i iname (class_defaults ci) ns ds
1440 let ds' = insertDefaults i iname (class_defaults ci) ns ds
1437 iLOG ("Defaults inserted: " ++ show ds' ++ "\n" ++ show ci)
1441 iLOG ("Defaults inserted: " ++ show ds' ++ "\n" ++ show ci)