Browse Source

Fixed override completion data bug.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
a798d1a622
  1. 7
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 31
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

7
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs

@ -1529,11 +1529,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -1529,11 +1529,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
return e.Name + "`" + e.TypeParameters.Count;
}
void AddVirtuals (Dictionary<string, bool> alreadyInserted, CompletionDataWrapper col, string modifiers, IType curType, int declarationBegin)
void AddVirtuals(Dictionary<string, bool> alreadyInserted, CompletionDataWrapper col, string modifiers, IType curType, int declarationBegin)
{
if (curType == null)
if (curType == null) {
return;
foreach (var m in curType.GetMethods (m => !m.IsConstructor && !m.IsDestructor).Cast<IMember> ().Concat (curType.GetProperties ().Cast<IMember> ()).Reverse ()) {
}
foreach (var m in curType.GetMembers ().Reverse ()) {
if (m.IsSynthetic || curType.Kind != TypeKind.Interface && !m.IsOverridable)
continue;
// filter out the "Finalize" methods, because finalizers should be done with destructors.

31
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

@ -1672,6 +1672,37 @@ class A @@ -1672,6 +1672,37 @@ class A
Assert.IsNull (provider.Find ("Finalize"), "'Finalize' found.");
});
}
[Test()]
public void TestOverrideCompletion ()
{
CombinedProviderTest (
@"using System;
class Base
{
public virtual int Property { get;}
public virtual int Method () { }
public virtual event EventHandler Event;
public virtual int this[int i] { get { } }
}
class A : Base
{
$public override $
}
", provider => {
Assert.IsNotNull (provider.Find ("Property"), "'Property' not found.");
Assert.IsNotNull (provider.Find ("Method"), "'Method' not found.");
Assert.IsNotNull (provider.Find ("Event"), "'Event' not found.");
Assert.IsNotNull (provider.Find ("ToString"), "'Event' not found.");
Assert.IsNotNull (provider.Find ("GetHashCode"), "'GetHashCode' not found.");
Assert.IsNotNull (provider.Find ("Equals"), "'Equals' not found.");
Assert.AreEqual (7, provider.Count);
});
}
/// <summary>
/// Bug 3370 -MD ignores member hiding

Loading…
Cancel
Save