+2005-02-21 Raja R Harinath <rharinath@novell.com>
+
+ Fix #72756.
+ * ecore.cs (Expression.MemberLookupFailed): Add argument to
+ disable the error message when the extended MemberLookup also
+ fails.
+ (Expression.MemberLookupFinal): Update.
+ (SimpleName.DoSimpleNameResolve): Update.
+ * expression.cs (MemberAccess.ResolveNamespaceOrType):
+ Don't use MemberLookupFinal.
+ (New.DoResolve): Update.
+ (BaseAccess.CommonResolve): Update.
+
2005-02-21 Raja R Harinath <rharinath@novell.com>
Fix #72732.
if (e == null && errors == Report.Errors)
// No errors were reported by MemberLookup, but there was an error.
- MemberLookupFailed (ec, qualifier_type, queried_type, name, null, loc);
+ MemberLookupFailed (ec, qualifier_type, queried_type, name, null, true, loc);
return e;
}
public static void MemberLookupFailed (EmitContext ec, Type qualifier_type,
Type queried_type, string name,
- string class_name, Location loc)
+ string class_name, bool complain_if_none_found,
+ Location loc)
{
if (almostMatchedMembers.Count != 0) {
if (qualifier_type == null) {
BindingFlags.NonPublic, name, null);
if (lookup == null) {
+ if (!complain_if_none_found)
+ return;
+
if (class_name != null)
Report.Error (103, loc, "The name `" + name + "' could not be " +
"found in `" + class_name + "'");
almostMatchedMembers = almost_matched;
if (almost_matched_type == null)
almost_matched_type = ec.ContainerType;
- MemberLookupFailed (ec, null, almost_matched_type, ((SimpleName) this).Name, ec.DeclSpace.Name, loc);
+ MemberLookupFailed (ec, null, almost_matched_type, ((SimpleName) this).Name, ec.DeclSpace.Name, true, loc);
return null;
}
if (method == null) {
if (almostMatchedMembers.Count != 0) {
- MemberLookupFailed (ec, type, type, ".ctor", null, loc);
+ MemberLookupFailed (ec, type, type, ".ctor", null, true, loc);
return null;
}
return null;
}
- Expression member_lookup = MemberLookupFinal (ec, expr_type, expr_type, Identifier, loc);
- if (!silent && member_lookup == null) {
- Report.Error (234, loc, "The type name `{0}' could not be found in type `{1}'",
- Identifier, new_expr.FullName);
+ Expression member_lookup = MemberLookup (ec, expr_type, expr_type, Identifier, loc);
+ if (member_lookup == null) {
+ int errors = Report.Errors;
+ MemberLookupFailed (ec, expr_type, expr_type, Identifier, null, false, loc);
+
+ if (!silent && errors == Report.Errors)
+ Report.Error (234, loc, "The type name `{0}' could not be found in type `{1}'",
+ Identifier, new_expr.FullName);
return null;
}
member_lookup = MemberLookup (ec, ec.ContainerType, null, base_type, member,
AllMemberTypes, AllBindingFlags, loc);
if (member_lookup == null) {
- MemberLookupFailed (ec, base_type, base_type, member, null, loc);
+ MemberLookupFailed (ec, base_type, base_type, member, null, true, loc);
return null;
}
+2005-02-21 Raja R Harinath <rharinath@novell.com>
+
+ * test-350.cs: New test from #72756.
+
2005-02-18 Marek Safar <marek.safar@seznam.cz>
* test-349.cs: New test.
test-291 test-292 test-293 test-294 test-295 test-296 test-297 test-298 test-299 test-300 \
test-301 test-302 test-303 test-304 test-305 test-306 test-307 test-309 test-310 \
test-312 test-313 test-314 test-315 test-316 test-317 test-318 test-320 \
- test-321 test-323 test-324 test-325 test-326 test-327 test-328 \
+ test-321 test-323 test-324 test-325 test-326 test-327 test-328 \
test-340 \
- test-343 \
+ test-343 test-350 \
cls-test-0 cls-test-1 cls-test-2 cls-test-3 cls-test-5 cls-test-6 cls-test-7 cls-test-10 \
cls-test-11 cls-test-12 cls-test-14 cls-test-15 cls-test-16 \
2test-1 2test-2 2test-3 2test-4 2test-5 2test-6 2test-7 2test-8 2test-9 2test-10 \
--- /dev/null
+using System;
+
+public class A
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
+ public class BAttribute : Attribute
+ {
+ }
+}
+
+
+[A.B()]
+public class C
+{
+ static void Main () {}
+}