Author: sudha
Date: 2005-05-25 05:51:25 -0400 (Wed, 25 May 2005)
New Revision: 44986

Modified:
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
Log:
* ObjectType.cs : Some fixes to Narrowing conversions
* VBBinder.cs : Fixed my previous checkin


Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-05-25 09:45:30 UTC (rev 44985)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-05-25 09:51:25 UTC (rev 44986)
@@ -1,3 +1,6 @@
+2005-05-25  Satya Sudha K <[EMAIL PROTECTED]>
+       * ObjectType.cs : Some fixes to Narrowing conversions
+
 2005-05-23  Satya Sudha K <[EMAIL PROTECTED]>
        * VBBinder.cs : Support for named arguments
 

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
  2005-05-25 09:45:30 UTC (rev 44985)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
  2005-05-25 09:51:25 UTC (rev 44986)
@@ -1447,6 +1447,10 @@
 
                        if (FromType == typeof (object)) // Object can be 
converted to any type
                                return true;
+
+                       if (FromType.IsArray || ToType.IsArray)
+                               return false;
+
                        TypeCode src_type = Type.GetTypeCode (FromType);
                        TypeCode dest_type = Type.GetTypeCode (ToType);
                        switch (dest_type) {
@@ -1505,16 +1509,13 @@
                                return true;
 
                        if (typeCode2 == TypeCode.String) {
-                               if (FromType == typeof (char[]))
+                               if (typeCode1 == TypeCode.Char || FromType == 
typeof (char[]))
                                        return true;
                                return false;
                        }
 
-                       if (typeCode1 == TypeCode.String) {
-                               if (typeCode2 == TypeCode.Char)
-                                       return true;
+                       if (typeCode1 == TypeCode.String)
                                return false;
-                       }
 
                        if (typeCode1 == TypeCode.DateTime || typeCode2 == 
TypeCode.DateTime)
                                return false;

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
    2005-05-25 09:45:30 UTC (rev 44985)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
    2005-05-25 09:51:25 UTC (rev 44986)
@@ -174,7 +174,7 @@
                                                numWideningConversions ++;
                                        mbase = filteredMatchList [x];
                                } else if (bestMatch == ctype) {
-                                       if (bestMatch == 
ConversionType.Widening) {
+                                       if (bestMatch == 
ConversionType.Widening || bestMatch == ConversionType.Exact) {
                                                // Got a widening conversion 
before also.
                                                // Find the best among the two
                                                int closestMatch = 
GetClosestMatch (mbase, filteredMatchList [x], args.Length);
@@ -195,7 +195,8 @@
                                //TODO : print the methods too
                                throw new AmbiguousMatchException ("No 
overloaded '" + this.objectType + "." + this.bindToName + "' can be called 
without a narrowing conversion");
                        }
-                       if ((bestMatch == ConversionType.Widening) && 
numWideningConversions > 1) {
+
+                       if ((bestMatch == ConversionType.Widening || bestMatch 
== ConversionType.Exact) && numWideningConversions > 1) {
                                //TODO : print the methods too
                                throw new AmbiguousMatchException ("No 
overloaded '" + this.objectType + "." + this.bindToName + "' can be called 
without a widening conversion");
                        }

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

Reply via email to