return null;
}
- public bool IsPossibleTypeOrNamespace (IMemberContext mc)
+ bool IsPossibleTypeOrNamespace (IMemberContext mc)
{
- return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing, loc) != null;
+ //
+ // Has to ignore static usings because we are looking for any member not just type
+ // in this context
+ //
+ return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing | LookupMode.IgnoreStaticUsing, loc) != null;
}
public bool IsPossibleType (IMemberContext mc)
return me;
}
+ //
+ // Stage 3: Lookup nested types, namespaces and type parameters in the context
+ //
+ if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
+ if (IsPossibleTypeOrNamespace (rc)) {
+ return ResolveAsTypeOrNamespace (rc, false);
+ }
+ }
+
var expr = NamespaceContainer.LookupStaticUsings (rc, Name, Arity, loc);
if (expr != null) {
if (Arity > 0) {
return expr;
}
- //
- // Stage 3: Lookup nested types, namespaces and type parameters in the context
- //
- if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
- if (IsPossibleTypeOrNamespace (rc)) {
- return ResolveAsTypeOrNamespace (rc, false);
- }
- }
-
if ((restrictions & MemberLookupRestrictions.NameOfExcluded) == 0 && Name == "nameof")
return new NameOf (this);
match = texpr_fne;
}
- if (types_using_table != null) {
+ if (types_using_table != null && (mode & LookupMode.IgnoreStaticUsing) == 0) {
foreach (var using_type in types_using_table) {
var type = MemberCache.FindNestedType (using_type, name, arity, true);
if (type == null)
--- /dev/null
+using System;
+using static TestClass;
+
+internal class Program
+{
+ public static void Main (string[] args)
+ {
+ var res = Directions.Up;
+ }
+}
+
+public enum Directions
+{
+ Up,
+ NotUp,
+}
+
+public static class TestClass
+{
+ public static int Directions;
+}
</method>
</type>
</test>
+ <test name="test-static-using-13.cs">
+ <type name="Program">
+ <method name="Void Main(System.String[])" attrs="150">
+ <size>4</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-var-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">