}
}
- return null;
+ return ErrorExpression.Instance;
}
if (rc.Module.Evaluator != null) {
// 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
//
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");
}
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);
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);
}
//
// 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;
//
// 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) {
}
}
+ //
+ // 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 ();
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);
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);
}