2010-04-28 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Wed, 28 Apr 2010 10:27:25 +0000 (10:27 -0000)
committerMarek Safar <marek.safar@gmail.com>
Wed, 28 Apr 2010 10:27:25 +0000 (10:27 -0000)
A fix for bug #600398
* convert.cs: Actually use effective base type for the comparison.

svn path=/trunk/mcs/; revision=156304

mcs/mcs/ChangeLog
mcs/mcs/convert.cs

index 902566c7513236808287ca1f37964468e1b9a708..edbf94e071a33c608ae74051919d803d68ad6bfd 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-28  Marek Safar  <marek.safar@gmail.com>
+
+       A fix for bug #600398
+       * convert.cs: Actually use effective base type for the comparison.
+
 2010-04-28  Marek Safar  <marek.safar@gmail.com>
 
        A fix for bug #600326
index e719336077543bbb5f3b09b09feb327f50e3bb8d..541e92098fec44513d44b9ab04276b6af9caa764 100644 (file)
@@ -112,7 +112,7 @@ namespace Mono.CSharp {
                        // From T to any base class of C
                        // From T to any interface implemented by C
                        //
-                       var base_type = expr_type.BaseType;
+                       var base_type = expr_type.GetEffectiveBase ();
                        if (base_type == target_type || TypeManager.IsSubclassOf (base_type, target_type) || base_type.ImplementsInterface (target_type)) {
                                if (expr_type.IsReferenceType)
                                        return new ClassCast (expr, target_type);
@@ -120,8 +120,6 @@ namespace Mono.CSharp {
                                return new BoxedCast (expr, target_type);
                        }
 
-                       base_type = expr_type.GetEffectiveBase ();
-
                        var effective_ifaces = expr_type.Interfaces;
                        if (effective_ifaces != null) {
                                foreach (var t in effective_ifaces) {