[Mono-bugs] [Bug 52154][Nor] New - text.Chars is accepted by mcs

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 23 Feb 2004 16:58:16 -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 krzak@pld-linux.org.

http://bugzilla.ximian.com/show_bug.cgi?id=52154

--- shadow/52154	2004-02-23 16:58:16.000000000 -0500
+++ shadow/52154.tmp.22892	2004-02-23 16:58:16.000000000 -0500
@@ -0,0 +1,69 @@
+Bug#: 52154
+Product: Mono/Compilers
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: text.Chars is accepted by mcs
+
+rodo provided the snippet of code: the code should not compile
+(there is no text.Chars property that can be called that way).
+using System;
+class T {
+	readonly int tabChars = 8;
+        private void WhiteLen (string text, ref int len, ref int chars) {
+               len = 0;
+               chars = 0;
+
+               while (chars < text.Chars
+                        && (text [chars] == ' ' || text [chars] == '\t')) {
+                        len += text [chars] == ' ' ? 1 : tabChars;
+                        chars ++;
+                }
+        }
+	static void Main () {}
+}
+
+------- Additional Comments From rodo@ximian.com  2003-12-14 09:23 -------
+simple standalone test case:
+
+class A
+{
+	static void B (string c, ref int d, ref int e)
+	{
+		System.Console.WriteLine ("{0}", c.Chars);
+	}
+
+	public static int Main (string[] args)
+	{
+		int f = 0;
+		int g = 0;
+
+		B ("lalala", ref f, ref g);
+
+		return 0;
+	}
+}
+
+
+------- Additional Comments From rodo@ximian.com  2003-12-14 09:31 -------
+ah, Paolo is right, the problem is to call to Chars property of
+String. (First I thought the problem is related to ref-ed variables)
+
+------- Additional Comments From krzak@pld-linux.org  2004-02-23 16:58 -------
+If I was trying to get Chars property with code, I get 
+
+** ERROR **: Invalid IL code at IL009b in .niisAMT:Main (string[]):
+IL_009b: callvirt  0x0a000003
+
+while run.