[Socket] Improved ConnectAsync
[mono.git] / mcs / mcs / ecore.cs
index 1b9646483fce61a8abf0fd94e48cbbaf4f3e8103..8563f28a212ce5cc0e2a06eeeec0c276788738df 100644 (file)
@@ -2311,7 +2311,7 @@ namespace Mono.CSharp {
                                                }
                                        }
 
-                                       return null;
+                                       return ErrorExpression.Instance;
                                }
 
                                if (rc.Module.Evaluator != null) {
@@ -2527,7 +2527,7 @@ namespace Mono.CSharp {
                        // Overload resulution works on virtual or non-virtual members only (no overrides). That
                        // means for base.member access we have to find the closest match after we found best candidate
                        //
-                       if ((method.Modifiers & (Modifiers.ABSTRACT | Modifiers.VIRTUAL | Modifiers.STATIC)) != Modifiers.STATIC) {
+                       if ((method.Modifiers & (Modifiers.ABSTRACT | Modifiers.VIRTUAL | Modifiers.OVERRIDE)) != 0) {
                                //
                                // The method could already be what we are looking for
                                //
@@ -2772,7 +2772,7 @@ namespace Mono.CSharp {
 
                public virtual MemberExpr ResolveMemberAccess (ResolveContext ec, Expression left, SimpleName original)
                {
-                       if (left != null && left.IsNull && TypeManager.IsReferenceType (left.Type)) {
+                       if (left != null && left.IsNull && TypeSpec.IsReferenceType (left.Type)) {
                                ec.Report.Warning (1720, 1, left.Location,
                                        "Expression will always cause a `{0}'", "System.NullReferenceException");
                        }
@@ -2784,9 +2784,9 @@ namespace Mono.CSharp {
                protected void EmitInstance (EmitContext ec, bool prepare_for_load)
                {
                        TypeSpec instance_type = InstanceExpression.Type;
-                       if (TypeManager.IsValueType (instance_type)) {
+                       if (TypeSpec.IsValueType (instance_type)) {
                                if (InstanceExpression is IMemoryLocation) {
-                                       ((IMemoryLocation) InstanceExpression).AddressOf (ec, AddressOp.LoadStore);
+                                       ((IMemoryLocation) InstanceExpression).AddressOf (ec, AddressOp.Load);
                                } else {
                                        LocalTemporary t = new LocalTemporary (instance_type);
                                        InstanceExpression.Emit (ec);
@@ -2797,7 +2797,7 @@ namespace Mono.CSharp {
                                InstanceExpression.Emit (ec);
 
                                // Only to make verifier happy
-                               if (instance_type.IsGenericParameter && !(InstanceExpression is This) && TypeManager.IsReferenceType (instance_type))
+                               if (instance_type.IsGenericParameter && !(InstanceExpression is This) && TypeSpec.IsReferenceType (instance_type))
                                        ec.Emit (OpCodes.Box, instance_type);
                        }
 
@@ -3381,7 +3381,7 @@ namespace Mono.CSharp {
                                //
                                // With identical parameter lists
                                //
-                               if (!TypeSpecComparer.Equals (p_m.Parameters.Types,q_m.Parameters.Types))
+                               if (!TypeSpecComparer.Equals (p_m.Parameters.Types, q_m.Parameters.Types))
                                        return 0;
 
                                p = p_m.ReturnType;
@@ -4027,7 +4027,7 @@ namespace Mono.CSharp {
                                //
                                // Deploy custom error reporting for lambda methods. When probing lambda methods
                                // keep all errors reported in separate set and once we are done and no best
-                               // candidate found, this set is used to report more details about what was wrong
+                               // candidate was found, this set is used to report more details about what was wrong
                                // with lambda body
                                //
                                if (argument.Expr.Type == InternalType.AnonymousMethod) {
@@ -4037,6 +4037,10 @@ namespace Mono.CSharp {
                                        }
                                }
 
+                               //
+                               // Use implicit conversion in all modes to return same candidates when the expression
+                               // is used as argument or delegate conversion
+                               //
                                if (!Convert.ImplicitConversionExists (ec, argument.Expr, parameter)) {
                                        if (lambda_conv_msgs != null) {
                                                lambda_conv_msgs.EndSession ();
@@ -4401,7 +4405,7 @@ namespace Mono.CSharp {
                                else
                                        ec.Report.Error (1620, loc, "Argument `#{0}' is missing `{1}' modifier",
                                                index, Parameter.GetModifierSignature (mod));
-                       } else {
+                       } else if (a.Expr != ErrorExpression.Instance) {
                                string p1 = a.GetSignatureForError ();
                                string p2 = TypeManager.CSharpName (paramType);
 
@@ -4791,7 +4795,7 @@ namespace Mono.CSharp {
                public bool IsMarshalByRefAccess (ResolveContext rc)
                {
                        // Checks possible ldflda of field access expression
-                       return !spec.IsStatic && TypeManager.IsValueType (spec.MemberType) && !(InstanceExpression is This) &&
+                       return !spec.IsStatic && TypeSpec.IsValueType (spec.MemberType) && !(InstanceExpression is This) &&
                                rc.Module.PredefinedTypes.MarshalByRefObject.Define () &&
                                TypeSpec.IsBaseClass (spec.DeclaringType, rc.Module.PredefinedTypes.MarshalByRefObject.TypeSpec, false);
                }