diff --git a/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj b/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj index c31f1197e..56a6eadb0 100644 --- a/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj +++ b/ICSharpCode.NRefactory.CSharp.AstVerifier/ICSharpCode.NRefactory.CSharp.AstVerifier.csproj @@ -14,7 +14,7 @@ true full false - bin\Debug\ + ..\bin\Debug\ DEBUG; prompt 4 @@ -23,7 +23,7 @@ none false - bin\Release\ + ..\bin\Release\ prompt 4 true @@ -32,7 +32,7 @@ true full false - bin\net_4_5_Debug\ + ..\bin\net_4_5_Debug\ DEBUG; prompt 4 @@ -42,7 +42,7 @@ none false - bin\net_4_5_Release\ + ..\bin\net_4_5_Release\ prompt 4 true diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs b/ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs index 0bb00cd26..0744fbbaf 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/MemberLookup.cs @@ -348,10 +348,12 @@ public ResolveResult Lookup(ResolveResult targetResolveResult, string name, ILis Predicate nestedTypeFilter = delegate(ITypeDefinition entity) { return entity.Name == name && IsAccessible(entity, allowProtectedAccess); }; + bool isStaticContext = targetResolveResult is TypeResolveResult; Predicate memberFilter = delegate(IUnresolvedMember entity) { // NOTE: Atm destructors can be looked up with 'Finalize' return entity.SymbolKind != SymbolKind.Indexer && - entity.SymbolKind != SymbolKind.Operator && + entity.SymbolKind != SymbolKind.Operator && + (!isStaticContext || entity.IsStatic) && entity.Name == name; }; diff --git a/ICSharpCode.NRefactory.Cecil/ICSharpCode.NRefactory.Cecil.csproj b/ICSharpCode.NRefactory.Cecil/ICSharpCode.NRefactory.Cecil.csproj index 2475b0abb..b80fdb591 100644 --- a/ICSharpCode.NRefactory.Cecil/ICSharpCode.NRefactory.Cecil.csproj +++ b/ICSharpCode.NRefactory.Cecil/ICSharpCode.NRefactory.Cecil.csproj @@ -23,39 +23,43 @@ true full false - bin\Debug + ..\bin\Debug\ prompt 4 false v4.0 + ..\bin\Debug\ICSharpCode.NRefactory.Cecil.xml PdbOnly True - bin\Release + ..\bin\Release\ prompt 4 false v4.0 + ..\bin\Release\ICSharpCode.NRefactory.Cecil.xml true full false - bin\Debug + ..\bin\net_4_5_Debug\ prompt 4 false v4.5 + ..\bin\net_4_5_Debug\ICSharpCode.NRefactory.Cecil.xml full true - bin\Release + ..\bin\net_4_5_Release\ prompt 4 false v4.5 + ..\bin\net_4_5_Release\ICSharpCode.NRefactory.Cecil.xml DEBUG; diff --git a/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj b/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj index c26c29252..b2a9c9506 100644 --- a/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj +++ b/ICSharpCode.NRefactory.ConsistencyCheck/ICSharpCode.NRefactory.ConsistencyCheck.csproj @@ -70,15 +70,19 @@ v4.0 + ..\bin\Debug\ v4.0 + ..\bin\Release\ v4.5 + ..\bin\net_4_5_Debug\ v4.5 + ..\bin\net_4_5_Release\ diff --git a/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj b/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj index 255831256..d2b02a4b3 100644 --- a/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj +++ b/ICSharpCode.NRefactory.GtkDemo/ICSharpCode.NRefactory.GtkDemo.csproj @@ -14,7 +14,7 @@ true full false - bin\Debug + ..\bin\Debug\ DEBUG; prompt 4 @@ -23,7 +23,7 @@ none false - bin\Release + ..\bin\Release\ prompt 4 false @@ -32,7 +32,7 @@ true full false - bin\Debug + ..\bin\net_4_5_Debug\ DEBUG; prompt 4 @@ -42,7 +42,7 @@ none false - bin\Release + ..\bin\net_4_5_Release\ prompt 4 false diff --git a/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj b/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj index 3932c463f..433b3f10d 100644 --- a/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj +++ b/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj @@ -16,41 +16,41 @@ true full false - bin\Debug + ..\bin\Debug\ DEBUG; prompt 4 false - v4.0 + v4.0 full true - bin\Release + ..\bin\Release\ prompt 4 false - v4.0 + v4.0 true full false - bin\Debug + ..\bin\net_4_5_Debug\ DEBUG; prompt 4 false - v4.5 + v4.5 full true - bin\Release + ..\bin\net_4_5_Release\ prompt 4 false - v4.5 + v4.5 diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Analysis/NullValueAnalysisTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Analysis/NullValueAnalysisTests.cs index e15cad4a8..2e22d6691 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Analysis/NullValueAnalysisTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Analysis/NullValueAnalysisTests.cs @@ -945,7 +945,6 @@ class TestClass int M() { return 0; } string TestMethod() { - object o = TestClass.i; object p = i; object q = M(); object m = this[0]; @@ -959,7 +958,6 @@ string TestMethod() var lastStatement = method.Body.Statements.Last(); - Assert.AreEqual(NullValueStatus.DefinitelyNotNull, analysis.GetVariableStatusAfterStatement(lastStatement, "o")); Assert.AreEqual(NullValueStatus.DefinitelyNotNull, analysis.GetVariableStatusAfterStatement(lastStatement, "p")); Assert.AreEqual(NullValueStatus.DefinitelyNotNull, analysis.GetVariableStatusAfterStatement(lastStatement, "q")); Assert.AreEqual(NullValueStatus.DefinitelyNotNull, analysis.GetVariableStatusAfterStatement(lastStatement, "m")); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs index fbf186135..5dc9d13ba 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Resolver/MemberLookupTests.cs @@ -208,6 +208,35 @@ public void M() { Assert.AreEqual("Test.F", rr.Member.FullName); Assert.IsInstanceOf(rr.TargetResult); } + + [Test] + public void InstanceMethodCallInStaticContext() + { + string program = @"using System; +class Test { + void F() {} + public void M() { + $Test.F()$; + } +}"; + var rr = Resolve(program); + } + + [Test] + public void ConstField() + { + string program = @"using System; +class Test { + const int C = 1; + public int M() { + return $Test.C$; + } +}"; + var rr = Resolve(program); + Assert.AreEqual("Test.C", rr.Member.FullName); + Assert.IsInstanceOf(rr.TargetResult); + } + [Test] public void TestOuterTemplateParameter() diff --git a/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs b/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs index 3d6cb9be7..c831620ee 100644 --- a/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs +++ b/ICSharpCode.NRefactory.Tests/Documentation/CSharpCrefLookupTests.cs @@ -138,6 +138,7 @@ public void Overloaded() } [Test] + [Ignore("Test should be method with no associated instance expression. C# 5.0 spec §7.6.4")] public void MethodInGenericInterface() { Assert.AreEqual("M:IGeneric`2.Test``1(``0[0:,0:]@)", diff --git a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj index 4f089f7d1..56d73401c 100644 --- a/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj +++ b/ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj @@ -87,7 +87,7 @@ - ..\..\cecil\Test\libs\nunit-2.5.10\nunit.framework.dll + ..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll