2004-05-24 Anders Carlsson <andersca@gnome.org>
[mono.git] / mcs / mcs / assign.cs
index dae00366584056cbf497f1f09ac838a78a6414b8..ecabbcad46194f8838d8dfdce1f0c6d48cf78016 100755 (executable)
@@ -262,11 +262,12 @@ namespace Mono.CSharp {
                        if ((source.eclass == ExprClass.Type) && (source is TypeExpr)) {
                                source.Error_UnexpectedKind ("variable or value");
                                return null;
-                       } else if (source is MethodGroupExpr){
+                       } else if (!RootContext.V2 && (source is MethodGroupExpr)){
                                ((MethodGroupExpr) source).ReportUsageError ();
                                return null;
-                       }
 
+                       }
+                       
                        if (target_type == source_type)
                                return this;
                        
@@ -294,11 +295,19 @@ namespace Mono.CSharp {
                                
                                        //
                                        // 2. and the original right side is implicitly convertible to
-                                       // the type of target_type.
+                                       // the type of target
                                        //
                                        if (Convert.ImplicitStandardConversionExists (a.original_source, target_type))
                                                return this;
 
+                                       //
+                                       // In the spec 2.4 they added: or if type of the target is int
+                                       // and the operator is a shift operator...
+                                       //
+                                       if (source_type == TypeManager.int32_type &&
+                                           (b.Oper == Binary.Operator.LeftShift || b.Oper == Binary.Operator.RightShift))
+                                               return this;
+
                                        Convert.Error_CannotImplicitConversion (loc, a.original_source.Type, target_type);
                                        return null;
                                }
@@ -378,10 +387,8 @@ namespace Mono.CSharp {
                        // 
                        IAssignMethod am = (IAssignMethod) target;
                        
-                       if (this is CompoundAssign){
+                       if (this is CompoundAssign)
                                am.CacheTemporaries (ec);
-                               use_temporaries = true;
-                       }
 
                        if (!is_statement)
                                use_temporaries = true;