[mono/mono] 5d20cad5: [sle] Enable char equality comparison. Fixes #15582

"Marek Safar ([email protected])" <[email protected]> Tue, 12 Nov 2013 19:49:22 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001424ddc73d4-10631d7f-1ab9-451c-9cd8-80a19c3d96f8-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/aea002c50438...5d20cad529b5

   Commit: 5d20cad529b59aad323bd50bd80987b017bcb6d7
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-11-12 19:45:13 GMT
      URL: https://github.com/mono/mono/commit/5d20cad529b59aad323bd50bd80987b017bcb6d7

[sle] Enable char equality comparison. Fixes #15582

Changed paths:
  M mcs/class/System.Core/System.Linq.Expressions/Expression.cs
  M mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs

Modified: mcs/class/System.Core/System.Linq.Expressions/Expression.cs
===================================================================
@@ -270,7 +270,7 @@ static MethodInfo BinaryCoreCheck (string oper_name, Expression left, Expression
 					if (ltype == rtype && ultype.IsEnum)
 						return null;
 
-					if (ltype == rtype && ultype == typeof (bool))
+					if (ltype == rtype && (ultype == typeof (bool) || ultype == typeof (char)))
 						return null;
 
 					if (ltype.IsNullable () && ConstantExpression.IsNull (right) && !ConstantExpression.IsNull (left))

Modified: mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs
===================================================================
@@ -82,6 +82,18 @@ public void Numeric ()
 		}
 
 		[Test]
+		public void PrimitiveNonNumeric ()
+		{
+			BinaryExpression expr = Expression.Equal (Expression.Constant ('a'), Expression.Constant ('b'));
+			Assert.AreEqual (ExpressionType.Equal, expr.NodeType);
+			Assert.AreEqual (typeof (bool), expr.Type);
+			Assert.IsNull (expr.Method);
+
+			var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
+			Assert.IsFalse (eq ());
+		}
+
+		[Test]
 		public void Nullable_LiftToNull_SetToFalse ()
 		{
 			int? a = 1;


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