[Mono-bugs] [Bug 417705] New: Unexpected compiler errors when using "as" keyword

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Aug 15 12:29:07 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=417705


           Summary: Unexpected compiler errors when using "as" keyword
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: acolwell at shelfari.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:
Compiler gives error for certain expressions that use "as" keyword when the
VisualStudio compiler doesn't.

Steps to reproduce the problem:

Compile the following code.

using System;
namespace AsStringProblem
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   object o = "Hello World";
   Console.WriteLine(o as string  + "blah");   // A. Error in Mono
   Console.WriteLine((o as string)  + "blah"); // B. Ok
   Console.WriteLine("blah" + o as string);    // C. Ok

  }
 }
}


Actual Results:
Line A produces a "error CS1002: Expecting `;'" error message

Expected Results:
The Visual Studio compiler doesn't complain about line A at all.

How often does this happen? 
Seems to happen when the "as" expression is followed by a +.

Additional Information:


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list