Merge pull request #498 from Unroll-Me/master
[mono.git] / mcs / mcs / namespace.cs
index e87d59521c4c6fa173baba0f8ad11d1c37f10da7..7dd44807f6810e358d40b258aed1bbce65ddb369 100644 (file)
@@ -498,12 +498,14 @@ namespace Mono.CSharp {
                                types = new Dictionary<string, IList<TypeSpec>> (64);
                        }
 
-                       if ((ts.IsStatic || ts.MemberDefinition.IsPartial) && ts.Arity == 0 &&
-                               (ts.MemberDefinition.DeclaringAssembly == null || ts.MemberDefinition.DeclaringAssembly.HasExtensionMethod)) {
-                               if (extension_method_types == null)
-                                       extension_method_types = new List<TypeSpec> ();
+                       if (ts.IsClass && ts.Arity == 0) {
+                               var extension_method_allowed = ts.MemberDefinition.IsImported ? (ts.Modifiers & Modifiers.METHOD_EXTENSION) != 0 : (ts.IsStatic || ts.MemberDefinition.IsPartial);
+                               if (extension_method_allowed) {
+                                       if (extension_method_types == null)
+                                               extension_method_types = new List<TypeSpec> ();
 
-                               extension_method_types.Add (ts);
+                                       extension_method_types.Add (ts);
+                               }
                        }
 
                        var name = ts.Name;
@@ -648,6 +650,11 @@ namespace Mono.CSharp {
                                        "Identifier `{0}' differing only in case is not CLS-compliant", compiled.GetSignatureForError ());
                        }
                }
+
+               public override string ToString ()
+               {
+                       return Name;
+               }
        }
 
        public class CompilationSourceFile : NamespaceContainer
@@ -1385,6 +1392,11 @@ namespace Mono.CSharp {
                                }
                        }
                }
+
+               public override string ToString()
+               {
+                       return resolved.ToString();
+               }
        }
 
        public class UsingExternAlias : UsingAliasNamespace