From e39bc70714e88d716c1242c3c1d0aa2c420546ff Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sun, 5 Oct 2014 19:26:31 +0200 Subject: [PATCH] Fix: Interface events indirectly implemented by a base class were not recognized and marked as "missing" by MissingInterfaceMemberImplementationIssue. --- .../CodeActions/ImplementInterfaceAction.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/ImplementInterfaceAction.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/ImplementInterfaceAction.cs index 625b49bf30..76261d9a18 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/ImplementInterfaceAction.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeActions/ImplementInterfaceAction.cs @@ -131,8 +131,21 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring continue; bool needsExplicitly = explicitly; - alreadyImplemented = implementingType.GetMembers().Any(m => m.ImplementedInterfaceMembers.Any(im => IsImplementation (im, ev))); + alreadyImplemented = false; + + foreach (var cmet in implementingType.GetMembers ()) { + alreadyImplemented |= cmet.ImplementedInterfaceMembers.Any(m => IsImplementation (m, ev)); + + if (CompareMembers(ev, cmet)) { + if (!needsExplicitly && !cmet.ReturnType.Equals(ev.ReturnType)) + needsExplicitly = true; + else + alreadyImplemented |= !needsExplicitly /*|| cmet.InterfaceImplementations.Any (impl => impl.InterfaceType.Equals (interfaceType))*/; + } + } + if (toImplement.Where(t => t.Item1 is IEvent).Any(t => CompareMembers(ev, (IEvent)t.Item1))) + needsExplicitly = true; if (!alreadyImplemented) { toImplement.Add(new Tuple(ev, needsExplicitly)); } else {