[Mono-bugs] [Bug 53493][Nor] New - Appending string with "as" expression fails

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 28 Jan 2004 17:54:43 -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 pierre@opnieuw.com.

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

--- shadow/53493	2004-01-28 17:54:43.000000000 -0500
+++ shadow/53493.tmp.22081	2004-01-28 17:54:43.000000000 -0500
@@ -0,0 +1,55 @@
+Bug#: 53493
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pierre@opnieuw.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Appending string with "as" expression fails
+
+Description of Problem:
+Appending string with "as" expression fails to compile.
+
+Steps to reproduce the problem:
+Save the following in Class1.cs and compile with mcs.
+
+using System;
+class Class1
+{
+	[STAThread]
+	static void Main(string[] args)
+	{
+		object someObject = "something";
+		string someString = someObject as string + " else";
+		Console.WriteLine(someString);
+	}
+}
+
+
+Actual Results:
+mcs reports error:
+"syntax error, expecting AS IS CLOSE_BRACE OPEN_BRACKET CLOSE_BRACKET 
+CLOSE_PARENS COMMA COLON SEMICOLON OP_LT OP_GT BITWISE_AND BITWISE_OR STAR 
+CARRET INTERR OP_LE OP_GE OP_EQ OP_NE OP_AND OP_OR
+Class1.cs(9) error CS1002: Expecting `;'
+Compilation failed: 1 error(s), 0 warnings"
+
+Expected Results:
+Microsoft's csc compiler produces the expected result of outputing:
+"something else"
+
+How often does this happen? 
+Always.
+
+Additional Information:
+The expression is recognized if written as follows:
+string someString = (someObject as string) + " else";