Author: martin
Date: 2005-03-22 05:10:27 -0500 (Tue, 22 Mar 2005)
New Revision: 42081
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/decl.cs
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
trunk/mcs/gmcs/namespace.cs
Log:
**** Merged r40699 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-03-22 10:07:30 UTC (rev 42080)
+++ trunk/mcs/gmcs/ChangeLog 2005-03-22 10:10:27 UTC (rev 42081)
@@ -1,3 +1,16 @@
+2005-02-15 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #71992.
+ * namespace.cs (NamespaceEntry.LookupNamespaceOrType): Add
+ 'ignore_cs0104' parameter. Pass it to ...
+ (NamespaceEntry.Lookup): ... this.
+ * decl.cs (DeclSpace.LookupType): Add 'ignore_cs0104' parameter.
+ * ecore.cs (SimpleName.ResolveAsTypeStep): Update.
+ (TypeLookupExpression.DoResolveAsTypeStep): Update.
+ * expression.cs (MemberAccess.IdenticalNameAndTypeName):
+ Update. Request that cs0104 errors be ignored.
+ (ComposedCast.ResolveAsTypeStep): Update.
+
2005-02-14 Raja R Harinath <[EMAIL PROTECTED]>
Fix #59209.
Modified: trunk/mcs/gmcs/decl.cs
===================================================================
--- trunk/mcs/gmcs/decl.cs 2005-03-22 10:07:30 UTC (rev 42080)
+++ trunk/mcs/gmcs/decl.cs 2005-03-22 10:10:27 UTC (rev 42081)
@@ -1206,11 +1206,12 @@
// Public function used to locate types, this can only
// be used after the ResolveTree function has been invoked.
//
+ // Set 'silent' to true if you want to suppress "type not
found" errors.
+ // Set 'ignore_cs0104' to true if you want to ignore cs0104
errors.
+ //
// Returns: Type or null if they type can not be found.
//
- // Come to think of it, this should be a DeclSpace
- //
- public FullNamedExpression LookupType (string name, bool
silent, Location loc)
+ public FullNamedExpression LookupType (string name, Location
loc, bool silent, bool ignore_cs0104)
{
FullNamedExpression e;
@@ -1261,7 +1262,7 @@
containing_ds = containing_ds.Parent;
}
- e = NamespaceEntry.LookupNamespaceOrType (this,
name, loc);
+ e = NamespaceEntry.LookupNamespaceOrType (this,
name, loc, ignore_cs0104);
if (!silent || e != null)
Cache [name] = e;
}
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-03-22 10:07:30 UTC (rev 42080)
+++ trunk/mcs/gmcs/ecore.cs 2005-03-22 10:10:27 UTC (rev 42081)
@@ -2083,7 +2083,7 @@
int errors = Report.Errors;
dt = ec.ResolvingTypeTree
? ds.FindType (loc, Name)
- : ds.LookupType (Name, true, loc);
+ : ds.LookupType (Name, loc, /*silent=*/ true,
/*ignore_cs0104=*/ false);
if (Report.Errors != errors)
return null;
@@ -2434,7 +2434,8 @@
protected override TypeExpr DoResolveAsTypeStep (EmitContext ec)
{
if (type == null) {
- FullNamedExpression t = ec.DeclSpace.LookupType
(name, false, Location.Null);
+ FullNamedExpression t = ec.DeclSpace.LookupType
(
+ name, Location.Null, /*silent=*/ false,
/*ignore_cs0104=*/ false);
if (t == null)
return null;
if (!(t is TypeExpr))
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-03-22 10:07:30 UTC (rev 42080)
+++ trunk/mcs/gmcs/expression.cs 2005-03-22 10:10:27 UTC (rev 42081)
@@ -7347,7 +7347,7 @@
if (sn == null || left == null || left.Type.Name !=
sn.Name)
return false;
- return ec.DeclSpace.LookupType (sn.Name, true, loc) !=
null;
+ return ec.DeclSpace.LookupType (sn.Name, loc,
/*silent=*/ true, /*ignore_cs0104*/ true) != null;
}
// TODO: possible optimalization
@@ -9002,24 +9002,16 @@
// ltype.Fullname is already fully qualified,
so we can skip
// a lot of probes, and go directly to
TypeManager.LookupType
//
+ // For now, fall back to the full lookup in
that case.
+ //
string fname = ltype.FullName != null ?
ltype.FullName : ltype.Name;
string cname = fname + dim;
- type = TypeManager.LookupTypeDirect (cname);
- if (type == null){
- //
- // For arrays of enumerations we are
having a problem
- // with the direct lookup. Need to
investigate.
- //
- // For now, fall back to the full
lookup in that case.
- //
- FullNamedExpression e =
ec.DeclSpace.LookupType (cname, false, loc);
- if (e is TypeExpr)
- type = ((TypeExpr)
e).ResolveType (ec);
- if (type == null)
- return null;
- }
- } else {
- type = ltype;
+ FullNamedExpression e = ec.DeclSpace.LookupType
(
+ cname, loc, /*silent=*/ false,
/*ignore_cs0104=*/ false);
+ if (e is TypeExpr)
+ type = ((TypeExpr) e).ResolveType (ec);
+ if (type == null)
+ return null;
}
if (!ec.InUnsafe && type.IsPointer){
Modified: trunk/mcs/gmcs/namespace.cs
===================================================================
--- trunk/mcs/gmcs/namespace.cs 2005-03-22 10:07:30 UTC (rev 42080)
+++ trunk/mcs/gmcs/namespace.cs 2005-03-22 10:10:27 UTC (rev 42081)
@@ -426,7 +426,7 @@
return entry == null ? null : entry.Resolve ();
}
- public FullNamedExpression LookupNamespaceOrType (DeclSpace ds,
string name, Location loc)
+ public FullNamedExpression LookupNamespaceOrType (DeclSpace ds,
string name, Location loc, bool ignore_cs0104)
{
FullNamedExpression resolved = null;
string rest = null;
@@ -439,7 +439,7 @@
}
for (NamespaceEntry curr_ns = this; curr_ns != null;
curr_ns = curr_ns.ImplicitParent) {
- if ((resolved = curr_ns.Lookup (ds, name, loc))
!= null)
+ if ((resolved = curr_ns.Lookup (ds, name, loc,
ignore_cs0104)) != null)
break;
}
@@ -457,7 +457,7 @@
return new TypeExpression (nested, Location.Null);
}
- private FullNamedExpression Lookup (DeclSpace ds, string name,
Location loc)
+ private FullNamedExpression Lookup (DeclSpace ds, string name,
Location loc, bool ignore_cs0104)
{
// Precondition: Only simple names (no dots) will be
looked up with this function.
@@ -486,7 +486,9 @@
match = using_ns.Lookup (ds, name, loc);
if ((match != null) && (match is TypeExpr)) {
if (t != null) {
-
DeclSpace.Error_AmbiguousTypeReference (loc, name, t.FullName, match.FullName);
+ if (!ignore_cs0104)
+
DeclSpace.Error_AmbiguousTypeReference (loc, name, t.FullName, match.FullName);
+
return null;
} else {
t = match;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches