@@ -534,12 +534,12 @@ Expression ParseIn()
534
534
else if ( left . Type != right . Type )
535
535
{
536
536
//check for nullable type match
537
- if ( ! left . Type . GetTypeInfo ( ) . IsGenericType ||
538
- left . Type . GetGenericTypeDefinition ( ) != typeof ( Nullable < > ) ||
539
- left . Type . GetTypeInfo ( ) . GetGenericTypeArguments ( ) [ 0 ] != right . Type )
540
- {
541
- throw ParseError ( op . Pos , Res . ExpressionTypeMismatch , left . Type ) ;
542
- }
537
+ // if (!left.Type.GetTypeInfo().IsGenericType ||
538
+ // left.Type.GetGenericTypeDefinition() != typeof(Nullable<>) ||
539
+ // left.Type.GetTypeInfo().GetGenericTypeArguments()[0] != right.Type)
540
+ // {
541
+ // throw ParseError(op.Pos, Res.ExpressionTypeMismatch, left.Type);
542
+ // }
543
543
544
544
CheckAndPromoteOperands ( typeof ( IEqualitySignatures ) , "==" , ref left , ref right , op . Pos ) ;
545
545
}
@@ -739,17 +739,14 @@ private ConstantExpression ParseEnumToConstantExpression(int pos, Type leftType,
739
739
740
740
private object ParseConstantExpressionToEnum ( int pos , Type leftType , ConstantExpression constantExpr )
741
741
{
742
- object parsedEnum = null ;
743
742
try
744
743
{
745
744
if ( constantExpr . Value is string )
746
745
{
747
- return parsedEnum = Enum . Parse ( GetNonNullableType ( leftType ) , constantExpr . Value as string , true ) ;
748
- }
749
- else
750
- {
751
- return parsedEnum = Enum . ToObject ( leftType , constantExpr . Value ) ;
746
+ return Enum . Parse ( GetNonNullableType ( leftType ) , ( string ) constantExpr . Value , true ) ;
752
747
}
748
+
749
+ return Enum . ToObject ( leftType , constantExpr . Value ) ;
753
750
}
754
751
catch
755
752
{
@@ -975,7 +972,7 @@ Expression ParseIntegerLiteral()
975
972
return CreateLiteral ( value , text ) ;
976
973
}
977
974
978
- if ( value <= ( int ) short . MaxValue ) return CreateLiteral ( ( short ) value , text ) ;
975
+ // if (value <= (int)short.MaxValue) return CreateLiteral((short)value, text);
979
976
if ( value <= int . MaxValue ) return CreateLiteral ( ( int ) value , text ) ;
980
977
if ( value <= uint . MaxValue ) return CreateLiteral ( ( uint ) value , text ) ;
981
978
if ( value <= long . MaxValue ) return CreateLiteral ( ( long ) value , text ) ;
0 commit comments