protected static void Error_CannotAccessProtected (Location loc, MemberInfo m, Type qualifier, Type container)
{
- Report.Error (1540, loc, "Cannot access protected member `{0}' via a qualifier of type `{1}';"
- + " the qualifier must be of type `{2}' (or derived from it)",
+ Report.Error (1540, loc, "Cannot access protected member `{0}' via a qualifier of type `{1}'."
+ + " The qualifier must be of type `{2}' or derived from it",
TypeManager.GetFullNameSignature (m),
TypeManager.CSharpName (qualifier),
TypeManager.CSharpName (container));
if (Type != TypeManager.string_type && this is Constant && !(this is EmptyConstantCast)) {
Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
- GetSignatureForError (), TypeManager.CSharpName (target));
+ ((Constant)(this)).GetValue ().ToString (), TypeManager.CSharpName (target));
return;
}
TypeManager.CSharpName (type), name);
}
+ protected static void Error_ValueAssignment (Location loc)
+ {
+ Report.Error (131, loc, "The left-hand side of an assignment must be a variable, a property or an indexer");
+ }
+
ResolveFlags ExprClassToResolveFlags
{
get {
if (out_access)
Report.Error (1510, loc, "A ref or out argument must be an assignable variable");
else
- Report.Error (131, loc, "The left-hand side of an assignment or mutating operation must be a variable, property or indexer");
+ Error_ValueAssignment (loc);
}
return null;
}
// then we are in this situation.
Error_CannotAccessProtected (loc, m, qualifier_type, container_type);
} else {
- Report.SymbolRelatedToPreviousError (m);
ErrorIsInaccesible (loc, TypeManager.GetFullNameSignature (m));
}
}
if (must_do_cs1540_check && (InstanceExpression != EmptyExpression.Null) &&
!TypeManager.IsInstantiationOfSameGenericType (InstanceExpression.Type, ec.ContainerType) &&
- TypeManager.IsFamilyAccessible (ec.ContainerType, PropertyInfo.DeclaringType) &&
- !TypeManager.IsFamilyAccessible (InstanceExpression.Type, ec.ContainerType)) {
+ !TypeManager.IsNestedChildOf (ec.ContainerType, InstanceExpression.Type) &&
+ !TypeManager.IsSubclassOf (InstanceExpression.Type, ec.ContainerType)) {
+ Report.SymbolRelatedToPreviousError (PropertyInfo);
Error_CannotAccessProtected (loc, PropertyInfo, InstanceExpression.Type, ec.ContainerType);
return false;
}