Don't complain when the same type is implemented by the
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 22 Jul 2009 11:10:49 +0000 (11:10 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 22 Jul 2009 11:10:49 +0000 (11:10 -0000)
output assembly as well as multiple referenced assemblies

* namespace.cs (RootNamespace.LookupTypeReflection): Add
'must_be_unique' flag.
(GlobalRootNamespace): Update to changes.
(Namespace.LookupType): Pass 'must_be_unique' only when we don't
already have a type in hand.

svn path=/trunk/mcs/; revision=138385

mcs/mcs/ChangeLog
mcs/mcs/namespace.cs

index 30d7af9149b1d340d2c177a015894718ec2c1e90..f51ce67c7031c94df7e7b217b4323618d40af6df 100644 (file)
@@ -1,3 +1,13 @@
+2009-07-22  Raja R Harinath  <harinath@hurrynot.org>
+
+       Don't complain when the same type is implemented by the output
+       assembly as well as multiple referenced assemblies
+       * namespace.cs (RootNamespace.LookupTypeReflection): Add
+       'must_be_unique' flag.
+       (GlobalRootNamespace): Update to changes.
+       (Namespace.LookupType): Pass 'must_be_unique' only when we don't
+       already have a type in hand.
+
 2009-07-22  Marek Safar  <marek.safar@gmail.com>
 
        * expression.cs: More verifier instrumentation.
index 4ee100f1b6866a8827756c65ddbfbb9872de9f36..2cfbea142b6490861577c7834a849f9f0ac310ba 100644 (file)
@@ -71,7 +71,7 @@ namespace Mono.CSharp {
                        }
                }
 
-               public virtual Type LookupTypeReflection (string name, Location loc)
+               public virtual Type LookupTypeReflection (string name, Location loc, bool must_be_unique)
                {
                        Type found_type = null;
 
@@ -80,6 +80,9 @@ namespace Mono.CSharp {
                                if (t == null)
                                        continue;
 
+                               if (!must_be_unique)
+                                       return t;
+
                                if (found_type == null) {
                                        found_type = t;
                                        continue;
@@ -303,9 +306,9 @@ namespace Mono.CSharp {
                        return (RootNamespace) root_namespaces[name];
                }
 
-               public override Type LookupTypeReflection (string name, Location loc)
+               public override Type LookupTypeReflection (string name, Location loc, bool must_be_unique)
                {
-                       Type found_type = base.LookupTypeReflection (name, loc);
+                       Type found_type = base.LookupTypeReflection (name, loc, must_be_unique);
 
                        if (modules != null) {
                                foreach (Module module in modules) {
@@ -520,7 +523,7 @@ namespace Mono.CSharp {
                                }
                        }
                        string lookup = t != null ? t.FullName : (fullname.Length == 0 ? name : fullname + "." + name);
-                       Type rt = root.LookupTypeReflection (lookup, loc);
+                       Type rt = root.LookupTypeReflection (lookup, loc, t == null);
 
                        // HACK: loc.IsNull when the type is core type
                        if (t == null || (rt != null && loc.IsNull))