In mcs:
authorRaja R Harinath <harinath@hurrynot.org>
Wed, 23 Feb 2005 12:56:04 +0000 (12:56 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Wed, 23 Feb 2005 12:56:04 +0000 (12:56 -0000)
2005-02-23  Raja R Harinath  <rharinath@novell.com>
    Abin Thomas  <projectmonokochi@rediffmail.com>
    Anoob V E  <projectmonokochi@rediffmail.com>
    Harilal P R  <projectmonokochi@rediffmail.com>

Fix #57851, #72718.
* class.cs (ConstructorBuilder.Resolve): Make sure that the second
MemberLookup (used for error reporting) actually returns a result.
Fix error report number (122, not 112).

In errors:
* cs0122-10.cs, CS0122-10-lib.cs: New tests based on #57851.
* Makefile (all-local): Add CS0122-10-lib.dll.
* cs0122-11.cs: New test based on #72718.
* cs0112-2.cs: Remove erroneous test.  Same as cs1501.cs.
* mcs-expect-wrong-error (cs1501.cs): Remove.

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

mcs/errors/CS0122-10-lib.cs [new file with mode: 0644]
mcs/errors/ChangeLog
mcs/errors/Makefile
mcs/errors/cs0112-2.cs [deleted file]
mcs/errors/cs0122-10.cs [new file with mode: 0644]
mcs/errors/cs0122-11.cs [new file with mode: 0644]
mcs/errors/gmcs-expect-wrong-error
mcs/errors/mcs-expect-wrong-error
mcs/mcs/ChangeLog
mcs/mcs/class.cs

diff --git a/mcs/errors/CS0122-10-lib.cs b/mcs/errors/CS0122-10-lib.cs
new file mode 100644 (file)
index 0000000..c48750b
--- /dev/null
@@ -0,0 +1,8 @@
+using System;
+
+namespace X {
+       public class Y {
+               internal Y(String test) {
+               }
+       }
+}
index 4a6dd95c230f2482440ab6699009531545462528..7074b91c15926ebb6d1d711569527c30997204b0 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-23  Raja R Harinath  <rharinath@novell.com>
+
+       * cs0122-10.cs, CS0122-10-lib.cs: New tests based on #57851.
+       * Makefile (all-local): Add CS0122-10-lib.dll.
+       * cs0122-11.cs: New test based on #72718.
+       * cs0112-2.cs: Remove erroneous test.  Same as cs1501.cs.
+       * mcs-expect-wrong-error (cs1501.cs): Remove.
+
 2005-02-22  Raja R Harinath  <rharinath@novell.com>
 
        * cs0115-3.c, cs0534-3.cs, cs0534-4.cs: New files based on #71134.
index 318c2aefa609dc973fced843bf64b3b4734d2b92..ccb4e723e9fff56bd42c8a1e509bb8f1fa852d9e 100644 (file)
@@ -29,8 +29,8 @@ DISTFILES = \
        generics-expect-no-error generics-expect-wrong-error
 
 #all-local: run-test-local test-multi-local
-all-local: CS0118-2-lib.dll CS0534-3-lib.dll CS0534-4-lib.dll CS0571-3-lib.dll CS0612-2-lib.dll CS0618-2-lib.dll \
-       CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll \
+all-local: CS0118-2-lib.dll CS0122-10-lib.dll CS0534-3-lib.dll CS0534-4-lib.dll CS0571-3-lib.dll \
+       CS0612-2-lib.dll CS0618-2-lib.dll CS0619-8-lib.dll CS0619-17-lib.dll CS0619-32-lib.dll CS0619-33-lib.dll CS0619-36-lib.dll \
        CS3005-16-lib.dll CS3013-module.dll
 
 test-local:
diff --git a/mcs/errors/cs0112-2.cs b/mcs/errors/cs0112-2.cs
deleted file mode 100644 (file)
index 161702a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// CS0112: `Foo.A.A' is inaccessible due to its protection level
-// Line: 11
-namespace Foo
-{
-       class A
-       {
-               private A (int a)
-               { }
-       }
-
-       class T : A
-       {
-       }
-}
diff --git a/mcs/errors/cs0122-10.cs b/mcs/errors/cs0122-10.cs
new file mode 100644 (file)
index 0000000..de31f50
--- /dev/null
@@ -0,0 +1,12 @@
+// cs0122: `X.Y.Y(string)' is inaccessible due to its protection level
+// Line: 9
+// Compiler options: -r:CS0122-10-lib.dll
+
+using System;
+using X;
+
+class T : Y {
+       public T(String test, String test1) : base(test) {
+       }
+       static void Main () {}
+}
diff --git a/mcs/errors/cs0122-11.cs b/mcs/errors/cs0122-11.cs
new file mode 100644 (file)
index 0000000..7488d8e
--- /dev/null
@@ -0,0 +1,15 @@
+// cs0122: `X.Y.Y(string)' is inaccessible due to its protection level
+// Line: 12
+
+using System;
+
+public class Y {
+       private Y(String test) {
+       }
+}
+
+class T : Y {
+       public T(String test, String test1) : base(test) {
+       }
+       static void Main () {}
+}
index 4724aaf9ad5eda626b27fbc326bf55a8c662c7ea..8fecd389723a23863b9fcd642e8222b5ec42dbdd 100644 (file)
@@ -13,6 +13,8 @@ cs0069.cs
 cs0116-2.cs
 cs0118.cs
 cs0119.cs
+cs0122-10.cs
+cs0122-11.cs
 cs0128.cs
 cs0133-2.cs
 cs0146-2.cs # new in GMCS
index b668320238136ad7dfed6e7c9d78b720dbd75bc2..70280e250c43bc06ef21981b094426dbf9fcf5c9 100644 (file)
@@ -51,7 +51,6 @@ cs0686.cs
 cs1007.cs
 cs1014.cs
 cs1501-5.cs
-cs1501.cs
 cs1513.cs
 cs1518.cs
 cs1525.cs
index 0756c6ce990328918ead6c23149638e9ec9e2f5b..596b1ad4218ccd0695e1c09e9d459da089792c51 100644 (file)
@@ -1,3 +1,13 @@
+2005-02-23  Raja R Harinath  <rharinath@novell.com>
+           Abin Thomas  <projectmonokochi@rediffmail.com>
+           Anoob V E  <projectmonokochi@rediffmail.com>
+           Harilal P R  <projectmonokochi@rediffmail.com>
+
+       Fix #57851, #72718.
+       * class.cs (ConstructorBuilder.Resolve): Make sure that the second
+       MemberLookup (used for error reporting) actually returns a result.
+       Fix error report number (122, not 112).
+
 2005-02-22  Abin Thomas  <projectmonokochi@rediffmail.com>
            Anoob V E  <projectmonokochi@rediffmail.com>
            Harilal P R  <projectmonokochi@rediffmail.com>
index 0f54ae6a36f2d49dcbf999a5714bad7304c5517c..4482b18f223e19716b20dfe552bf29e71ce9364d 100644 (file)
@@ -3912,6 +3912,7 @@ namespace Mono.CSharp {
                {
                        Expression base_constructor_group;
                        Type t;
+                       bool error = false;
 
                        ec.CurrentBlock = new ToplevelBlock (Block.Flags.Implicit, parameters, loc);
 
@@ -3942,34 +3943,34 @@ namespace Mono.CSharp {
                                loc);
                        
                        if (base_constructor_group == null){
+                               error = true;
                                base_constructor_group = Expression.MemberLookup (
-                                       ec, t, ".ctor", MemberTypes.Constructor,
+                                       ec, t, null, t, ".ctor", MemberTypes.Constructor,
                                        BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly,
                                        loc);
+                       }
 
-                               if (base_constructor_group != null)
-                                       Report.Error (
-                                               112, loc, "`{0}.{1}' is inaccessible due to " +
-                                               "its protection level", t.FullName, t.Name);
-                               else
-                                       Report.Error (
-                                               1501, loc, "Can not find a constructor for " +
-                                               "this argument list");
+                       int errors = Report.Errors;
+                       if (base_constructor_group != null)
+                               base_constructor = (ConstructorInfo) Invocation.OverloadResolve (
+                                       ec, (MethodGroupExpr) base_constructor_group, argument_list,
+                                       false, loc);
+                       
+                       if (base_constructor == null) {
+                               if (errors == Report.Errors)
+                                       Report.Error (1501, loc, "Can not find a constructor for this argument list");
                                return false;
                        }
-                       
-                       base_constructor = (ConstructorInfo) Invocation.OverloadResolve (
-                               ec, (MethodGroupExpr) base_constructor_group, argument_list,
-                               false, loc);
-                       
-                       if (base_constructor == null){
-                               Report.Error (1501, loc,
-                                      "Can not find a constructor for this argument list");
+
+                       if (error) {
+                               Report.Error (122, loc, "`{0}' is inaccessible due to its protection level",
+                                             TypeManager.CSharpSignature (base_constructor));
+                               base_constructor = null;
                                return false;
                        }
 
                        if (base_constructor == caller_builder){
-                               Report.Error (516, String.Format ("Constructor `{0}' can not call itself", TypeManager.CSharpSignature (caller_builder)));
+                               Report.Error (516, loc, "Constructor `{0}' can not call itself", TypeManager.CSharpSignature (caller_builder));
                                return false;
                        }