Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2005-08-16 13:21:41 +0400
committerMarek Safar <marek.safar@gmail.com>2005-08-16 13:21:41 +0400
commit08c8eaa6cd668fb552117ead1d3c6b5577deea24 (patch)
tree20ea36f4c93a2f0a757eb1522d28b857361ea47f /mcs/tests/test-437.cs
parent2f86fae2727e978aac2d55d182fe3d9e04a66a95 (diff)
parent44c85abe672c365d85713a1547d2ee0c5f1347ae (diff)
2005-08-16 Marek Safar <marek.safar@seznam.cz>
The big constants rewrite Fix #75746, #75685 and more As a side effect saved 1MB for MWF ;-) * attribute.cs (GetAttributeArgumentExpression): Use ToType, GetTypedValue. (GetMarshal, GetMethodImplOptions, GetLayoutKindValue): Values are not enum based for corlib compilation. * cfold.cs (BinaryFold): Convert operand for enum additions. Fixed enum subtractions. * class.cs (FixedField.Define): Use ResolveAsConstant. * const.cs (IConstant): Interface constants and enums. (Const.ResolveValue): New method for constant resolvning. (ExternalConstant): Constants from imported assemblies. * constant.cs (Constant.GetTypedValue): Used to get constant with forced conversion; like enums. (Constant.ToType): Converts this constant to different type. (Constant.Increment): Adds 1. * convert.cs (ImplicitConversionRequired): Simplified. * cs-parser.jay: Create EnumMember directly. * decl.cs (MemberCore.CheckObsoleteness): Checks for ObsoleteAttribute presence. * doc.cs (GenerateEnumDocComment): Removed. * ecore.cs (Expression.ResolveAsConstant): New constant specific method. (ConvertIntLiteral): Removed. (FieldExpr.ResolveMemberAccess): Refactored to remove constant specific if(s). * enum.cs (EnumMember): Implement IConstant. (Enum.IsValidEnumConstant): Removed. (Enum.GetNextDefaultValue): Removed. (Enum.FindMembers): Updated. (Enum.GenerateDocComment): Iterate enum members. * expression.cs (Cast.TryReduce): Handle enums correctly. (New.Constantify): Made public. (MemberAccess.DoResolve): Removed contant specific if(s). * literal.cs (NullLiteral): Implement new abstract methods. * statement.cs (GotoCase.Resolve): Use new constant methods. (SwitchLabel.ResolveAndReduce): Use new constant methods. * typemanager.cs (LookupEnum): Removed. (IsEnumType): Fixed to work with corlib. (RegisterConstant): Removed. (LookupConstant): Removed. (GetConstant): Changed to work with IConstant. svn path=/trunk/mcs/; revision=48416
Diffstat (limited to 'mcs/tests/test-437.cs')
-rw-r--r--mcs/tests/test-437.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/mcs/tests/test-437.cs b/mcs/tests/test-437.cs
new file mode 100644
index 00000000000..88ed74501de
--- /dev/null
+++ b/mcs/tests/test-437.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Runtime.InteropServices;
+
+class T2
+{
+ public enum E2: sbyte
+ {
+ A = Test.E.d,
+ B = Test.E.a,
+ C = Test.Constant
+ }
+
+}
+
+class Test
+{
+ public const UnmanagedType UnmanagedType_80 = (UnmanagedType) 80;
+ public const sbyte Constant = (sbyte)T2.E2.A;
+
+ public enum E: sbyte
+ {
+ a = -3,
+ b = d,
+ c = T2.E2.B,
+ d,
+ e,
+ f = -Constant,
+ g = checked (3 * 4),
+ h = unchecked ((sbyte)(250 + 10))
+ }
+
+ public static void Main ()
+ {
+ Console.WriteLine (E.d.ToString ());
+ Console.WriteLine (Constant.ToString ());
+ object o = E.a;
+ Console.WriteLine (E.a);
+ Console.WriteLine (System.Reflection.BindingFlags.NonPublic);
+ }
+}