From 241e383926984646e1409d3ada24e30882d52cdc Mon Sep 17 00:00:00 2001 From: Raja R Harinath Date: Wed, 22 Jul 2009 11:10:49 +0000 Subject: [PATCH] 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. svn path=/trunk/mcs/; revision=138385 --- mcs/mcs/ChangeLog | 10 ++++++++++ mcs/mcs/namespace.cs | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog index 30d7af9149b..f51ce67c703 100644 --- a/mcs/mcs/ChangeLog +++ b/mcs/mcs/ChangeLog @@ -1,3 +1,13 @@ +2009-07-22 Raja R Harinath + + 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 * expression.cs: More verifier instrumentation. diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs index 4ee100f1b68..2cfbea142b6 100644 --- a/mcs/mcs/namespace.cs +++ b/mcs/mcs/namespace.cs @@ -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)) -- 2.25.1