[Mono-bugs] [Bug 37111][Wis] New - mcs can't handle the private access scope
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Thu, 23 Jan 2003 03:51:31 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by daniel@solin.org.
http://bugzilla.ximian.com/show_bug.cgi?id=37111
--- shadow/37111 Thu Jan 23 03:51:31 2003
+++ shadow/37111.tmp.8719 Thu Jan 23 03:51:31 2003
@@ -0,0 +1,91 @@
+Bug#: 37111
+Product: Mono/MCS
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: daniel@solin.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs can't handle the private access scope
+
+Description of Problem:
+MCS doesn't seem to handle the private access scope correctly.
+
+Steps to reproduce the problem:
+1. Create calculator.cs:
+namespace Calculator
+{
+ class MyCalculator
+ {
+ private Validator va = new Validator();
+
+ public int add(int val1, int val2)
+ {
+ if(va.validate(val1) && va.validate(val2))
+ return (val1+val2);
+ else
+ return 0;
+ }
+
+ private class Validator
+ {
+ public bool validate(int val)
+ {
+ if(val<0)
+ return false;
+ else
+ return true;
+ }
+ }
+ }
+}
+
+2. Compilte calculator.cs into a dll:
+daniel@localhost:~$ mcs /t:library calculator.cs
+
+3. Create myclass.cs:
+using System;
+using Calculator;
+
+class MyClass
+{
+ public static void Main(string[] args)
+ {
+ MyCalculator.Validator v = new MyCalculator.Validator();
+ }
+}
+
+4. Compile myclass.cs:
+daniel@localhost:~$ mcs /r:./calculator.dll myclass.cs
+
+
+Actual Results:
+Compiles fine.
+
+Expected Results:
+Since we're trying to access the private
+class Validator from myclass.cs here, this should generate an error.
+The MS compiler gives me the following:
+
+C:\temp>csc /r:./calculator.dll myclass.cs
+Microsoft (R) Visual C# .NET Compiler version 7.00.9466
+for Microsoft (R) .NET Framework version 1.0.3705
+Copyright (C) Microsoft Corporation 2001. All rights reserved.
+
+myclass.cs(8,9): error CS0122: 'Calculator.MyCalculator' is inaccessible
+due to its protection level
+
+
+How often does this happen?
+Always.
+
+Additional Information:
+This is closely related to bug# 37108.