@@ -270,11 +270,20 @@ elabInterface info_in syn_in doc what fc constraints tn tnfc ps pDocs fds ds mcn
270270 = do when (not $ null cs) . tclift
271271 $ tfail (At fc (Msg "Default super interface implementations can't have constraints."))
272272 i <- getIState
273− let t = PApp fc (PRef fc [] n) (map pexp ps)
274− let isConstrained = any (== t) (map snd constraints)
273+ let isConstrained = any (checkConstrained i n (map pexp ps)) (map snd constraints)
275274 when (not isConstrained) . tclift
276275 $ tfail (At fc (Msg "Default implementations must be for a super interface constraint on the containing interface."))
277276 return ()
277+ where
278+ -- First, Check that interface "constraint" has same name & args as default implementation name & args (not checking FC)
279+ -- If not the case, recursively lookup in context for parent interface & recheck the same with parent constraints
280+ checkConstrained i n args constraint =
281+ if (n == cn && args == cargs)
282+ then True
283+ else any (id) (map (checkConstrained i n args) parentConstraints)
284+ where
285+ PApp _ (PRef _ _ cn) cargs = constraint
286+ parentConstraints = concatMap interface_constraints (lookupCtxt cn (idris_interfaces i))
278287
279288 checkConstraintName :: [Name] -> Name -> Idris ()
280289 checkConstraintName bound cname