[Mono-bugs] [Bug 23932] New - integer literals for "small" integer types (byte)

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
26 Apr 2002 21:23:15 -0000


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 martin@gnome.org.

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

--- shadow/23932	Fri Apr 26 17:23:15 2002
+++ shadow/23932.tmp.11006	Fri Apr 26 17:23:15 2002
@@ -0,0 +1,44 @@
+Bug#: 23932
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: martin@gnome.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: integer literals for "small" integer types (byte)
+
+MCS doesn't handle integer literals correctly.
+
+Const.LookupConstantValue() always gets an IntLiteral/UIntLiteral
+expression instead of a ByteLiteral etc. one.
+
+To reproduce, try
+
+	private const Byte MyByte1 = 42;
+
+I've added some debugging output to const.c around line 150:
+
+	Console.WriteLine ("CONSTANT: " + Location + " " + 
+FieldBuilder.FieldType + " " + Expr + " " + ConstantValue + " " + 
+ConstantValue.GetType ());
+
+	FieldBuilder.SetConstant (ConstantValue);
+
+this prints
+
+CONSTANT: c:\TEMP\martin\mcs\class\corlib\Test\System\ByteTest.cs: (17) 
+System.Byte IntLiteral (42) 42 System.Int32
+
+and raises an exception since you can't assign a System.Int32 to a 
+System.Byte constant.
+
+Martin