Fixed string null constant conversion to object constant
[mono.git] / mcs / mcs / namespace.cs
index 7dd44807f6810e358d40b258aed1bbce65ddb369..f454b93498665cd1da1c66d74f2f4d03f96d42e9 100644 (file)
@@ -252,7 +252,7 @@ namespace Mono.CSharp {
 
                        case "System.Windows.Forms":
                        case "System.Windows.Forms.Layout":
-                               assembly = "System.Windows.Name";
+                               assembly = "System.Windows.Forms";
                                break;
                        }
 
@@ -276,16 +276,7 @@ namespace Mono.CSharp {
 
                public Namespace AddNamespace (MemberName name)
                {
-                       Namespace ns_parent;
-                       if (name.Left != null) {
-                               if (parent != null)
-                                       ns_parent = parent.AddNamespace (name.Left);
-                               else
-                                       ns_parent = AddNamespace (name.Left);
-                       } else {
-                               ns_parent = this;
-                       }
-
+                       var ns_parent = name.Left == null ? this : AddNamespace (name.Left);
                        return ns_parent.TryAddNamespace (name.Basename);
                }
 
@@ -378,8 +369,10 @@ namespace Mono.CSharp {
                                        if (mode != LookupMode.Normal)
                                                continue;
 
-                                       if (ts.MemberDefinition.IsImported)
+                                       if (ts.MemberDefinition.IsImported) {
+                                               ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best);
                                                ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts);
+                                       }
 
                                        ctx.Module.Compiler.Report.Warning (436, 2, loc,
                                                "The type `{0}' conflicts with the imported type of same name'. Ignoring the imported type definition",
@@ -761,6 +754,11 @@ namespace Mono.CSharp {
 
                        return Compiler.Settings.IsConditionalSymbolDefined (value);
                }
+
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
        }
 
 
@@ -894,7 +892,7 @@ namespace Mono.CSharp {
                        MemberCore mc;
                        if (names_container.DefinedNames.TryGetValue (name, out mc)) {
                                if (tc is NamespaceContainer && mc is NamespaceContainer) {
-                                       containers.Add (tc);
+                                       AddTypeContainerMember (tc);
                                        return;
                                }
 
@@ -1064,6 +1062,9 @@ namespace Mono.CSharp {
 
                public override void GetCompletionStartingWith (string prefix, List<string> results)
                {
+                       if (Usings == null)
+                               return;
+
                        foreach (var un in Usings) {
                                if (un.Alias != null)
                                        continue;
@@ -1139,7 +1140,7 @@ namespace Mono.CSharp {
                        if (aliases != null && arity == 0) {
                                UsingAliasNamespace uan;
                                if (aliases.TryGetValue (name, out uan)) {
-                                       if (fne != null) {
+                                       if (fne != null && mode != LookupMode.Probing) {
                                                // TODO: Namespace has broken location
                                                //Report.SymbolRelatedToPreviousError (fne.Location, null);
                                                Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null);
@@ -1332,6 +1333,11 @@ namespace Mono.CSharp {
 
                        return false;
                }
+
+               public override void Accept (StructuralVisitor visitor)
+               {
+                       visitor.Visit (this);
+               }
        }
 
        public class UsingNamespace