Author: raja
Date: 2005-07-06 09:02:01 -0400 (Wed, 06 Jul 2005)
New Revision: 46994

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/statement.cs
   trunk/mcs/tests/known-issues-mcs
Log:
* statement.cs (Switch.SwitchGoverningType): Only look at
UserCasts that don't need implicit standard conversions to one of
the allowed switch types (Fixes test-322.cs).
(LocalInfo.Resolve): Re-enable sanity-test.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-07-06 12:52:49 UTC (rev 46993)
+++ trunk/mcs/mcs/ChangeLog     2005-07-06 13:02:01 UTC (rev 46994)
@@ -1,3 +1,10 @@
+2005-07-06  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * statement.cs (Switch.SwitchGoverningType): Only look at
+       UserCasts that don't need implicit standard conversions to one of
+       the allowed switch types (Fixes test-322.cs).
+       (LocalInfo.Resolve): Re-enable sanity-test.
+
 2005-07-06  Marek Safar  <[EMAIL PROTECTED]>
 
        * cs-tokenizer.cs (consume_identifier): Detect double undescores

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2005-07-06 12:52:49 UTC (rev 46993)
+++ trunk/mcs/mcs/statement.cs  2005-07-06 13:02:01 UTC (rev 46994)
@@ -1070,10 +1070,10 @@
                                Report.Error (723, Location, "Cannot declare 
variable of static type `{0}'", TypeManager.CSharpName (VariableType));
                                return false;
                        }
-// TODO: breaks the build
-//                     if (VariableType.IsPointer && !ec.InUnsafe)
-//                             Expression.UnsafeError (Location);
 
+                       if (VariableType.IsPointer && !ec.InUnsafe)
+                               Expression.UnsafeError (Location);
+
                        return true;
                }
 
@@ -2434,33 +2434,33 @@
                //
                Expression SwitchGoverningType (EmitContext ec, Type t)
                {
-                       if (t == TypeManager.int32_type ||
-                           t == TypeManager.uint32_type ||
-                           t == TypeManager.char_type ||
-                           t == TypeManager.byte_type ||
+                       if (t == TypeManager.byte_type ||
                            t == TypeManager.sbyte_type ||
                            t == TypeManager.ushort_type ||
                            t == TypeManager.short_type ||
+                           t == TypeManager.uint32_type ||
+                           t == TypeManager.int32_type ||
                            t == TypeManager.uint64_type ||
                            t == TypeManager.int64_type ||
+                           t == TypeManager.char_type ||
                            t == TypeManager.string_type ||
-                               t == TypeManager.bool_type ||
-                               t.IsSubclassOf (TypeManager.enum_type))
+                           t == TypeManager.bool_type ||
+                           t.IsSubclassOf (TypeManager.enum_type))
                                return Expr;
 
                        if (allowed_types == null){
                                allowed_types = new Type [] {
-                                       TypeManager.int32_type,
-                                       TypeManager.uint32_type,
                                        TypeManager.sbyte_type,
                                        TypeManager.byte_type,
                                        TypeManager.short_type,
                                        TypeManager.ushort_type,
+                                       TypeManager.int32_type,
+                                       TypeManager.uint32_type,
                                        TypeManager.int64_type,
                                        TypeManager.uint64_type,
                                        TypeManager.char_type,
-                                       TypeManager.bool_type,
-                                       TypeManager.string_type
+                                       TypeManager.string_type,
+                                       TypeManager.bool_type
                                };
                        }
 
@@ -2482,22 +2482,18 @@
                                // Ignore over-worked ImplicitUserConversions 
that do
                                // an implicit conversion in addition to the 
user conversion.
                                // 
-                               if (e is UserCast){
-                                       UserCast ue = e as UserCast;
+                               if (!(e is UserCast))
+                                       continue;
 
-                                       if (ue.Source != Expr)
-                                               e = null;
-                               }
-                               
                                if (converted != null){
                                        Report.ExtraInformation (
                                                loc,
                                                String.Format ("reason: more 
than one conversion to an integral type exist for type {0}",
                                                               
TypeManager.CSharpName (Expr.Type)));
                                        return null;
-                               } else {
-                                       converted = e;
                                }
+
+                               converted = e;
                        }
                        return converted;
                }

Modified: trunk/mcs/tests/known-issues-mcs
===================================================================
--- trunk/mcs/tests/known-issues-mcs    2005-07-06 12:52:49 UTC (rev 46993)
+++ trunk/mcs/tests/known-issues-mcs    2005-07-06 13:02:01 UTC (rev 46994)
@@ -5,10 +5,9 @@
 # csXXXX.cs IGNORE     : adds test to ignore list
 
 test-50.cs IGNORE      # Windows-only tests
+test-67.cs IGNORE      # Windows-only test
+
 test-308.cs
-test-322.cs
 test-377.cs
 test-anon-27.cs
 test-xml-027.cs
-
-test-67.cs IGNORE      # Windows-only test

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to