+2004-08-23 Martin Baulig <martin@ximian.com>
+
+ Back to the old error reporting system :-)
+
+ * report.cs (Message): Removed.
+ (Report.MessageData, ErrorData, WarningData): Removed.
+ (Report.Error, Warning): Back to the old system.
+
2004-08-23 Martin Baulig <martin@ximian.com>
* decl.cs (IMemberContainer.Parent): Renamed to ParentContainer.
Location);
if (member != null) {
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, Location, GetFullMemberName (member_name));
+ Report.Error (122, Location, "'{0}' is inaccessible due to its protection level", GetFullMemberName (member_name));
return null;
}
}
AttributeUsageAttribute usage_attr = GetAttributeUsage ();
if ((usage_attr.ValidOn & Target) == 0) {
- Report.Error (Message.CS0592_Attribute_is_not_valid_on_this_declaration_type, Location, Name, GetValidTargets ());
+ Report.Error (592, Location, "Attribute '{0}' is not valid on this declaration type. It is valid on {1} declarations only.", Name, GetValidTargets ());
return;
}
return;
if (arg.Type.IsArray) {
- Report.Error (Message.CS3016_Arrays_as_attribute_arguments_are_not_CLS_compliant, Location);
+ Report.Error (3016, Location, "Arrays as attribute arguments are not CLS-compliant");
return;
}
}
return;
if (arg.Type.IsArray) {
- Report.Error (Message.CS3016_Arrays_as_attribute_arguments_are_not_CLS_compliant, Location);
+ Report.Error (3016, Location, "Arrays as attribute arguments are not CLS-compliant");
return;
}
}
sb.Append (", ");
}
sb.Remove (sb.Length - 2, 2);
- Report.Error (Message.CS0657_is_not_a_valid_attribute_location_for_this_declaration, a.Location, a.Target, sb.ToString ());
+ Report.Error (657, a.Location, "'{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'", a.Target, sb.ToString ());
}
}
foreach (Parameter arg in fixedParameters) {
if (!AttributeTester.IsClsCompliant (arg.ParameterType)) {
- Report.Error (Message.CS3001_Argument_type_is_not_CLS_compliant, loc, arg.GetSignatureForError ());
+ Report.Error (3001, loc, "Argument type '{0}' is not CLS-compliant", arg.GetSignatureForError ());
return false;
}
}
for (int i = 1; i < modules.Length; ++i) {
Module module = modules [i];
if (!IsClsCompliant (module)) {
- Report.Error (Message.CS3013_Added_modules_must_be_marked_with_the_CLSCompliant_attribute_to_match_the_assembly, module.Name);
+ Report.Error (3013, "Added modules must be marked with the CLSCompliant attribute to match the assembly", module.Name);
return;
}
}
else
Report.SymbolRelatedToPreviousError ((MemberCore)conflict);
- Report.Error (Message.CS3005_Identifier_differing_only_in_case_is_not_CLS_compliant, decl.Location, decl.GetSignatureForError ());
+ Report.Error (3005, decl.Location, "Identifier '{0}' differing only in case is not CLS-compliant", decl.GetSignatureForError ());
}
}
public static void Report_ObsoleteMessage (ObsoleteAttribute oa, string member, Location loc)
{
if (oa.IsError) {
- Report.Error (Message.CS0619_error_is_obsolete, loc, member, oa.Message);
+ Report.Error (619, loc, "'{0}' is obsolete: '{1}'", member, oa.Message);
return;
}
if (oa.Message == null) {
- Report.Warning (Message.CS0612_is_obsolete, loc, member);
+ Report.Warning (612, loc, "'{0}' is obsolete", member);
return;
}
- Report.Warning (Message.CS0618_warning_is_obsolete, loc, member, oa.Message);
+ Report.Warning (618, loc, "'{0}' is obsolete: '{1}'", member, oa.Message);
}
public static bool IsConditionalMethodExcluded (MethodBase mb)
base.DefineContainerMembers ();
if (HasEquals && !HasGetHashCode) {
- Report.Warning (Message.CS0659_overrides_Equals_but_does_not_override_GetHashCode, container.Location, container.GetSignatureForError ());
+ Report.Warning (659, container.Location, "'{0}' overrides Object.Equals(object) but does not override Object.GetHashCode()", container.GetSignatureForError ());
}
}
}
if (i.IndexerName != class_indexer_name)
- Report.Error (Message.CS0668_Two_indexers_have_different_names, i.Location);
+ Report.Error (668, i.Location, "Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type");
}
if (class_indexer_name != null)
if (has_equality_or_inequality && container.Methods == null && (RootContext.WarningLevel > 2)) {
if (!container.Methods.HasEquals)
- Report.Warning (Message.CS0660_defines_operator_but_does_not_override_Equals, container.Location, container.GetSignatureForError ());
+ Report.Warning (660, container.Location, "'{0}' defines operator == or operator != but does not override Object.Equals(object o)", container.GetSignatureForError ());
if (!container.Methods.HasGetHashCode)
- Report.Warning (Message.CS0661_defines_operator_but_does_not_override_GetHashCode, container.Location, container.GetSignatureForError ());
+ Report.Warning (661, container.Location, "'{0}' defines operator == or operator != but does not override Object.GetHashCode()", container.GetSignatureForError ());
}
}
MemberInfo conflict_symbol = Parent.MemberCache.FindMemberWithSameName (Basename, false, TypeBuilder);
if (conflict_symbol == null) {
if ((ModFlags & Modifiers.NEW) != 0)
- Report.Warning (Message.CS0109_The_member_does_not_hide_an_inherited_member_new_keyword_is_not_required, Location, GetSignatureForError ());
+ Report.Warning (109, Location, "The member '{0}' does not hide an inherited member. The new keyword is not required", GetSignatureForError ());
} else {
if ((ModFlags & Modifiers.NEW) == 0) {
Report.SymbolRelatedToPreviousError (conflict_symbol);
- Report.Warning (Message.CS0108_The_keyword_new_is_required, Location, GetSignatureForError ());
+ Report.Warning (108, Location, "The keyword new is required on '{0}' because it hides inherited member", GetSignatureForError ());
}
}
}
continue;
if ((f.status & Field.Status.USED) == 0){
- Report.Warning (Message.CS0169_The_private_field_is_never_used, f.Location, f.GetSignatureForError ());
+ Report.Warning (169, f.Location, "The private field '{0}' is never used", f.GetSignatureForError ());
continue;
}
if ((f.status & Field.Status.ASSIGNED) != 0)
continue;
- Report.Warning (Message.CS0649_Field_is_never_assigned_to_and_will_always_have_its_default_value, f.Location, f.GetSignatureForError (), "");
+ Report.Warning (649, f.Location, "Field '{0}' is never assigned to, and will always have its default value '{1}'", f.GetSignatureForError (), "");
}
}
if (events != null){
foreach (Event e in events){
if (e.status == 0)
- Report.Warning (Message.CS0067_The_event_is_never_used, e.Location, e.GetSignatureForError ());
+ Report.Warning (67, e.Location, "The event '{0}' is never used", e.GetSignatureForError ());
}
}
}
has_compliant_args = c.HasCompliantArgs;
}
if (!has_compliant_args)
- Report.Error (Message.CS3015_has_no_accessible_constructors_which_use_only_CLS_compliant_types, Location, GetSignatureForError ());
+ Report.Error (3015, Location, "'{0}' has no accessible constructors which use only CLS-compliant types", GetSignatureForError ());
} else {
foreach (Constructor c in instance_constructors)
c.Emit ();
// parent_container is null for System.Object
if (parent_container != null && !AttributeTester.IsClsCompliant (parent_container.Type)) {
- Report.Error (Message.CS3009_base_type_is_not_CLS_compliant, Location, GetSignatureForError (), TypeManager.CSharpName (parent_container.Type));
+ Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (parent_container.Type));
}
return true;
}
} else {
Report.SymbolRelatedToPreviousError ((MemberCore) found);
}
- Report.Error (Message.CS3005_Identifier_differing_only_in_case_is_not_CLS_compliant, mc.Location, mc.GetSignatureForError ());
+ Report.Error (3005, mc.Location, "Identifier '{0}' differing only in case is not CLS-compliant", mc.GetSignatureForError ());
}
}
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
if ((ModFlags & (Modifiers.ABSTRACT | Modifiers.SEALED)) == (Modifiers.ABSTRACT | Modifiers.SEALED)) {
- Report.Error (Message.CS0502_cannot_be_both_abstract_and_sealed, Location, GetSignatureForError ());
+ Report.Error (502, Location, "'{0}' cannot be both abstract and sealed", GetSignatureForError ());
}
attribute_usage = new AttributeUsageAttribute (AttributeTargets.All);
// Is null for System.Object while compiling corlib and base interfaces
if (Parent.ParentContainer == null) {
if ((ModFlags & Modifiers.NEW) != 0) {
- Report.Warning (Message.CS0109_The_member_does_not_hide_an_inherited_member_new_keyword_is_not_required, Location, GetSignatureForError (Parent));
+ Report.Warning (109, Location, "The member '{0}' does not hide an inherited member. The new keyword is not required", GetSignatureForError (Parent));
}
return true;
}
ObsoleteAttribute oa = AttributeTester.GetMethodObsoleteAttribute (parent_method);
if (oa != null) {
Report.SymbolRelatedToPreviousError (parent_method);
- Report.Warning (Message.CS0672_Member_overrides_obsolete_member, Location, GetSignatureForError (Parent));
+ Report.Warning (672, Location, "Member '{0}' overrides obsolete member. Add the Obsolete attribute to '{0}'", GetSignatureForError (Parent));
}
return true;
}
if ((ModFlags & Modifiers.OVERRIDE) != 0) {
- Report.Error (Message.CS0115_No_suitable_methods_found_to_override, Location, GetSignatureForError (Parent));
+ Report.Error (115, Location, "'{0}': no suitable methods found to override", GetSignatureForError (Parent));
return false;
}
MemberInfo conflict_symbol = Parent.FindMemberWithSameName (Name, !(this is Property));
if (conflict_symbol == null) {
if ((ModFlags & Modifiers.NEW) != 0) {
- Report.Warning (Message.CS0109_The_member_does_not_hide_an_inherited_member_new_keyword_is_not_required, Location, GetSignatureForError (Parent));
+ Report.Warning (109, Location, "The member '{0}' does not hide an inherited member. The new keyword is not required", GetSignatureForError (Parent));
}
return true;
}
return true;
Report.SymbolRelatedToPreviousError (conflict_symbol);
- Report.Warning (Message.CS0108_The_keyword_new_is_required, Location, GetSignatureForError (Parent));
+ Report.Warning (108, Location, "The keyword new is required on '{0}' because it hides inherited member", GetSignatureForError (Parent));
}
return true;
{
if (!base.VerifyClsCompliance (ds)) {
if ((ModFlags & Modifiers.ABSTRACT) != 0 && IsExposedFromAssembly (ds) && ds.IsClsCompliaceRequired (ds)) {
- Report.Error (Message.CS3011_only_CLS_compliant_members_can_be_abstract, Location, GetSignatureForError ());
+ Report.Error (3011, Location, "'{0}': only CLS-compliant members can be abstract", GetSignatureForError ());
}
return false;
}
if (Parameters.HasArglist) {
- Report.Error (Message.CS3000_Methods_with_variable_arguments_are_not_CLS_compliant, Location);
+ Report.Error (3000, Location, "Methods with variable arguments are not CLS-compliant");
}
if (!AttributeTester.IsClsCompliant (MemberType)) {
- Report.Error (Message.CS3002_Return_type_of_is_not_CLS_compliant, Location, GetSignatureForError ());
+ Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant", GetSignatureForError ());
}
AttributeTester.AreParametersCompliant (Parameters.FixedParameters, Location);
}
Report.SymbolRelatedToPreviousError (method);
- Report.Error (Message.CS0111_Type_already_defines_member_with_the_same_parameter_types, Location, Parent.Name, Name);
+ Report.Error (111, Location, "Type '{0}' already defines a member called '{1}' with the same parameter types", Parent.Name, Name);
return true;
}
if (a.Type == TypeManager.dllimport_type) {
const int extern_static = Modifiers.EXTERN | Modifiers.STATIC;
if ((ModFlags & extern_static) != extern_static) {
- Report.Error (Message.CS0601_The_DllImport_attribute_must_be_specified_on_a_method_marked_static_and_extern, a.Location);
+ Report.Error (601, a.Location, "The DllImport attribute must be specified on a method marked `static' and `extern'");
}
return;
if (a.Type == TypeManager.conditional_attribute_type) {
if (IsOperator || IsExplicitImpl) {
- Report.Error (Message.CS0577_Conditional_not_valid_on_because_it_is_a_destructor_operator_or_explicit_interface_implementation, Location, GetSignatureForError ());
+ Report.Error (577, Location, "Conditional not valid on '{0}' because it is a destructor, operator, or explicit interface implementation", GetSignatureForError ());
return;
}
if (ReturnType != TypeManager.void_type) {
- Report.Error (Message.CS0578_Conditional_not_valid_on_because_its_return_type_is_not_void, Location, GetSignatureForError ());
+ Report.Error (578, Location, "Conditional not valid on '{0}' because its return new ErrorData ( type is not void", GetSignatureForError ());
return;
}
if ((ModFlags & Modifiers.OVERRIDE) != 0) {
- Report.Error (Message.CS0243_Conditional_not_valid_on_because_it_is_an_override_method, Location, GetSignatureForError ());
+ Report.Error (243, Location, "Conditional not valid on '{0}' because it is an override method", GetSignatureForError ());
return;
}
if (IsInterface) {
- Report.Error (Message.CS0582_Conditional_not_valid_on_interface_members, Location);
+ Report.Error (582, Location, "Conditional not valid on interface members");
return;
}
if (MethodData.IsImplementing) {
- Report.Error (Message.CS0629_Conditional_member_cannot_implement_interface_member, Location, GetSignatureForError ());
+ Report.Error (629, Location, "Conditional member '{0}' cannot implement interface member", GetSignatureForError ());
return;
}
}
}
} else
{
- Report.Warning (Message.CS0028_The_wrong_signature_to_be_an_entry_point, Location, TypeManager.CSharpSignature(MethodBuilder) );
+ Report.Warning (28, Location, "'{0}' has the wrong signature to be an entry point", TypeManager.CSharpSignature(MethodBuilder) );
}
}
}
if ((Parent.ModFlags & Modifiers.SEALED) != 0 && (ModFlags & Modifiers.PROTECTED) != 0) {
- Report.Warning (Message.CS0628_New_protected_member_declared_in_sealed_class, Location, GetSignatureForError (Parent));
+ Report.Warning (628, Location, "'{0}': new protected member declared in sealed class", GetSignatureForError (Parent));
}
return true;
// We are more strict than Microsoft and report CS0626 like error
if (method.OptAttributes == null ||
!method.OptAttributes.Contains (TypeManager.methodimpl_attr_type, ec)) {
- Report.Error (Message.CS0626_Method_operator_or_accessor_is_marked_external_and_has_no_attributes_on_it, method.Location, method.GetSignatureForError (container));
+ Report.Error (626, method.Location, "Method, operator, or accessor '{0}' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation", method.GetSignatureForError (container));
return;
}
}
public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.conditional_attribute_type) {
- Report.Error (Message.CS0577_Conditional_not_valid_on_because_it_is_a_destructor_operator_or_explicit_interface_implementation, Location, GetSignatureForError ());
+ Report.Error (577, Location, "Conditional not valid on '{0}' because it is a destructor, operator, or explicit interface implementation", GetSignatureForError ());
return;
}
if ((Parent.ModFlags & Modifiers.SEALED) != 0 && (ModFlags & Modifiers.PROTECTED) != 0 &&
(ModFlags & Modifiers.OVERRIDE) == 0 && Name != "Finalize") {
- Report.Warning (Message.CS0628_New_protected_member_declared_in_sealed_class, Location, GetSignatureForError (Parent));
+ Report.Warning (628, Location, "'{0}': new protected member declared in sealed class", GetSignatureForError (Parent));
}
return true;
}
}
if (IsInterface && HasClsCompliantAttribute && ds.IsClsCompliaceRequired (ds)) {
- Report.Error (Message.CS3010_CLS_compliant_interfaces_must_have_only_CLScompliant_members, Location, GetSignatureForError ());
+ Report.Error (3010, Location, "'{0}': CLS-compliant interfaces must have only CLS-compliant members", GetSignatureForError ());
}
return false;
}
FieldBuilder.SetMarshal (marshal);
return;
}
- Report.Warning (Message.CS_24_The_Microsoft_Runtime_cannot_set_this_marshal_info, a.Location);
+ Report.Warning (-24, a.Location, "The Microsoft Runtime cannot set this marshal info. Please use the Mono runtime instead.");
return;
}
conflict_symbol = Parent.FindMemberWithSameName (Name, false);
if (conflict_symbol == null) {
if ((ModFlags & Modifiers.NEW) != 0) {
- Report.Warning (Message.CS0109_The_member_does_not_hide_an_inherited_member_new_keyword_is_not_required, Location, GetSignatureForError (Parent));
+ Report.Warning (109, Location, "The member '{0}' does not hide an inherited member. The new keyword is not required", GetSignatureForError (Parent));
}
return true;
}
if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0) {
Report.SymbolRelatedToPreviousError (conflict_symbol);
- Report.Warning (Message.CS0108_The_keyword_new_is_required, Location, GetSignatureForError (Parent));
+ Report.Warning (108, Location, "The keyword new is required on '{0}' because it hides inherited member", GetSignatureForError (Parent));
}
return true;
}
if (MemberType == TypeManager.arg_iterator_type || MemberType == TypeManager.typed_reference_type) {
- Report.Error (Message.CS0610_Field_or_property_cannot_be_of_type, Location, TypeManager.CSharpName (MemberType));
+ Report.Error (610, Location, "Field or property cannot be of type '{0}'", TypeManager.CSharpName (MemberType));
return false;
}
}
if (!AttributeTester.IsClsCompliant (FieldBuilder.FieldType)) {
- Report.Error (Message.CS3003_Type_is_not_CLS_compliant, Location, GetSignatureForError ());
+ Report.Error (3003, Location, "Type of '{0}' is not CLS-compliant", GetSignatureForError ());
}
return true;
}
{
if (a.Type == TypeManager.cls_compliant_attribute_type || a.Type == TypeManager.obsolete_attribute_type ||
a.Type == TypeManager.conditional_attribute_type) {
- Report.Error (Message.CS1667_is_not_valid_on_property_or_event_accessors, a.Location, TypeManager.CSharpName (a.Type), a.GetValidTargets ());
+ Report.Error (1667, a.Location, "'{0}' is not valid on property or event accessors. It is valid on '{1}' declarations only", TypeManager.CSharpName (a.Type), a.GetValidTargets ());
return;
}
return false;
if (MemberType == TypeManager.arg_iterator_type || MemberType == TypeManager.typed_reference_type) {
- Report.Error (Message.CS0610_Field_or_property_cannot_be_of_type, Location, TypeManager.CSharpName (MemberType));
+ Report.Error (610, Location, "Field or property cannot be of type '{0}'", TypeManager.CSharpName (MemberType));
return false;
}
if (conflict_symbol != null && (ModFlags & Modifiers.NEW) == 0) {
if (!(conflict_symbol is EventInfo)) {
Report.SymbolRelatedToPreviousError (conflict_symbol);
- Report.Error (Message.CS0072_Event_can_override_only_event, Location, GetSignatureForError (Parent));
+ Report.Error (72, Location, "Event '{0}' can override only event", GetSignatureForError (Parent));
return false;
}
}
IndexerName = indexer_attr.GetIndexerAttributeValue (ec);
if (IsExplicitImpl) {
- Report.Error (Message.CS0415_The_IndexerName_attribute_is_valid_only_on_an_indexer_that_is_not_an_explicit_interface_member_declaration, indexer_attr.Location);
+ Report.Error (415, indexer_attr.Location, "The 'IndexerName' attribute is valid only on an indexer that is not an explicit interface member declaration");
return false;
}
if ((ModFlags & Modifiers.OVERRIDE) != 0) {
- Report.Error (Message.CS0609_Cannot_set_the_IndexerName_attribute_on_an_indexer_marked_override, indexer_attr.Location);
+ Report.Error (609, indexer_attr.Location, "Cannot set the 'IndexerName' attribute on an indexer marked override");
return false;
}
if (!Tokenizer.IsValidIdentifier (IndexerName)) {
- Report.Error (Message.CS0633_The_argument_to_the_IndexerName_attribute_must_be_a_valid_identifier, indexer_attr.Location);
+ Report.Error (633, indexer_attr.Location, "The argument to the 'IndexerName' attribute must be a valid identifier");
return false;
}
}
if (first_arg_type.IsSubclassOf (return_type)
|| return_type.IsSubclassOf (first_arg_type)){
if (declaring_type.IsSubclassOf (return_type)) {
- Report.Error (Message.CS0553_user_defined_conversion_to_from_base_class, Location, GetSignatureForError ());
+ Report.Error (553, Location, "'{0}' : user defined conversion to/from base class", GetSignatureForError ());
return false;
}
- Report.Error (Message.CS0554_user_defined_conversion_to_from_derived_class, Location, GetSignatureForError ());
+ Report.Error (554, Location, "'{0}' : user defined conversion to/from derived class", GetSignatureForError ());
return false;
}
} else if (SecondArgType == null) {
case "System.Reflection.AssemblyKeyFileAttribute":
if (RootContext.StrongNameKeyFile != null) {
Report.SymbolRelatedToPreviousError (a.Location, a.Name);
- Report.Warning (Message.CS1616_Option_overrides_options_given_in_source, "keyfile", "System.Reflection.AssemblyKeyFileAttribute");
+ Report.Warning (1616, "Compiler option '{0}' overrides '{1}' given in source", "keyfile", "System.Reflection.AssemblyKeyFileAttribute");
}
else {
string value = a.GetString ();
case "System.Reflection.AssemblyKeyNameAttribute":
if (RootContext.StrongNameKeyContainer != null) {
Report.SymbolRelatedToPreviousError (a.Location, a.Name);
- Report.Warning (Message.CS1616_Option_overrides_options_given_in_source, "keycontainer", "System.Reflection.AssemblyKeyNameAttribute");
+ Report.Warning (1616, "keycontainer", "Compiler option '{0}' overrides '{1}' given in source", "System.Reflection.AssemblyKeyNameAttribute");
}
else {
string value = a.GetString ();
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
{
if (a != null && a.Type == TypeManager.cls_compliant_attribute_type) {
- Report.Warning (Message.CS3012_You_must_specify_the_CLSCompliant_attribute_on_the_assembly_not_the_module_to_enable_CLS_compliance_checking, a.Location);
+ Report.Warning (3012, a.Location, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
return;
}
// if we have not seen anything in between
// report this error
//
- Report.Warning (Message.CS0078_The_l_suffix_is_easily_confused_with_the_digit_1, Location);
+ Report.Warning (78, Location, "The 'l' suffix is easily confused with the digit '1' (use 'L' for clarity)");
}
goto case 'L';
return true;
case "warning":
- Report.Warning (Message.CS1030_warning, Location, arg);
+ Report.Warning (1030, Location, "#warning: '{0}'", arg);
return true;
}
{
if (!IsClsCompliaceRequired (ds)) {
if (HasClsCompliantAttribute && !IsExposedFromAssembly (ds)) {
- Report.Warning (Message.CS3019_CLS_compliance_checking_will_not_be_performed_on_because_it_is_private_or_internal, Location, GetSignatureForError ());
+ Report.Warning (3019, Location, "CLS compliance checking will not be performed on '{0}' because it is private or internal", GetSignatureForError ());
}
return false;
}
if (!CodeGen.Assembly.IsClsCompliant) {
if (HasClsCompliantAttribute) {
- Report.Error (Message.CS3014_cannot_be_marked_as_CLS_compliant_because_the_assembly_does_not_have_a_CLSCompliant_attribute, Location, GetSignatureForError ());
+ Report.Error (3014, Location, "'{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute", GetSignatureForError ());
}
}
int index = Name.LastIndexOf ('.');
if (Name [index > 0 ? index + 1 : 0] == '_') {
- Report.Error (Message.CS3008_Identifier_is_not_CLS_compliant, Location, GetSignatureForError () );
+ Report.Error (3008, Location, "Identifier '{0}' is not CLS-compliant", GetSignatureForError () );
}
return true;
}
}
if (!d.CheckAccessLevel (this)) {
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, loc, d.Name);
+ Report.Error (122, loc, "'{0}' is inaccessible due to its protection level", d.Name);
return null;
}
continue;
Report.SymbolRelatedToPreviousError (entry.Member);
- Report.Error (Message.CS3006_Overloaded_method_differing_only_in_ref_or_out_or_in_array_rank_is_not_CLS_compliant, method.Location, method.GetSignatureForError ());
+ Report.Error (3006, method.Location, "Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant", method.GetSignatureForError ());
}
}
}
AttributeTester.AreParametersCompliant (Parameters.FixedParameters, Location);
if (!AttributeTester.IsClsCompliant (ReturnType.Type)) {
- Report.Error (Message.CS3002_Return_type_of_is_not_CLS_compliant, Location, GetSignatureForError ());
+ Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant", GetSignatureForError ());
}
return true;
}
IMethodData md = TypeManager.GetMethod (delegate_method);
if (md == null) {
if (System.Attribute.GetCustomAttribute (delegate_method, TypeManager.conditional_attribute_type) != null) {
- Report.Error (Message.CS1618_Cannot_create_delegate_with_because_it_has_a_Conditional_attribute, loc, TypeManager.CSharpSignature (delegate_method));
+ Report.Error (1618, loc, "Cannot create delegate with '{0}' because it has a Conditional attribute", TypeManager.CSharpSignature (delegate_method));
}
} else {
if (md.OptAttributes != null && md.OptAttributes.Search (TypeManager.conditional_attribute_type, ec) != null) {
- Report.Error (Message.CS1618_Cannot_create_delegate_with_because_it_has_a_Conditional_attribute, loc, TypeManager.CSharpSignature (delegate_method));
+ Report.Error (1618, loc, "Cannot create delegate with '{0}' because it has a Conditional attribute", TypeManager.CSharpSignature (delegate_method));
}
}
if (RootContext.MainClass != null) {
object main_cont = RootContext.Tree.Decls [RootContext.MainClass];
if (main_cont == null) {
- Report.Error (Message.CS1555_Could_not_find_specified_for_Main_method, output_file, RootContext.MainClass);
+ Report.Error (1555, output_file, "Could not find '{0}' specified for Main method", RootContext.MainClass);
return false;
}
if (!(main_cont is ClassOrStruct)) {
- Report.Error (Message.CS1556_specified_for_Main_method_must_be_a_valid_class_or_struct, output_file, RootContext.MainClass);
+ Report.Error (1556, output_file, "'{0}' specified for Main method must be a valid class or struct", RootContext.MainClass);
return false;
}
}
/// <summary>
/// Utility wrapper routine for Warning, just to beautify the code
/// </summary>
- public void Warning (Message msg, string arg)
+ public void Warning (int code, string format, params object[] args)
{
- Report.Warning (msg, loc, arg);
+ Report.Warning (code, loc, format, args);
}
/// <summary>
}
if (qualifier_type != null)
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, loc, TypeManager.CSharpName (qualifier_type) + "." + name);
+ Report.Error (122, loc, "'{0}' is inaccessible due to its protection level", TypeManager.CSharpName (qualifier_type) + "." + name);
else if (name == ".ctor") {
Report.Error (143, loc, String.Format ("The type {0} has no constructors defined",
TypeManager.CSharpName (queried_type)));
} else {
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, loc, name);
+ Report.Error (122, loc, "'{0}' is inaccessible due to its protection level", name);
}
}
is_static = true;
if (setter == null && getter == null){
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, loc, PropertyInfo.Name);
+ Report.Error (122, loc, "'{0}' is inaccessible due to its protection level", PropertyInfo.Name);
}
}
builder.SetMarshal (marshal);
return;
}
- Report.Warning (Message.CS_24_The_Microsoft_Runtime_cannot_set_this_marshal_info, a.Location);
+ Report.Warning (-24, a.Location, "The Microsoft Runtime cannot set this marshal info. Please use the Mono runtime instead.");
return;
}
EnumMember conflict = (EnumMember)ht [locase];
Report.SymbolRelatedToPreviousError (conflict);
conflict = (EnumMember)name_to_member [name];
- Report.Error (Message.CS3005_Identifier_differing_only_in_case_is_not_CLS_compliant, conflict.Location, conflict.GetSignatureForError ());
+ Report.Error (3005, conflict.Location, "Identifier '{0}' differing only in case is not CLS-compliant", conflict.GetSignatureForError ());
}
}
VerifyClsName ();
if (!AttributeTester.IsClsCompliant (UnderlyingType)) {
- Report.Error (Message.CS3009_base_type_is_not_CLS_compliant, Location, GetSignatureForError (), TypeManager.CSharpName (UnderlyingType));
+ Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (UnderlyingType));
}
return true;
}
if (warning_always_matches)
- Warning (Message.CS0183_The_given_expression_is_always_of_the_provided_type, TypeManager.CSharpName (probe_type));
+ Warning (183, "The given expression is always of the provided ('{0}') type", TypeManager.CSharpName (probe_type));
else if (warning_never_matches){
if (!(probe_type.IsInterface || expr.Type.IsInterface))
- Warning (Message.CS0184_The_given_expression_is_never_of_the_provided_type, TypeManager.CSharpName (probe_type));
+ Warning (184, "The given expression is never of the provided ('{0}') type", TypeManager.CSharpName (probe_type));
}
return this;
Type expr_type = expr.Type;
if (expr is TypeExpr){
if (!ec.DeclSpace.CheckAccessLevel (expr_type)){
- Report.Error (Message.CS0122_is_inaccessible_due_to_its_protection_level, loc, expr_type);
+ Report.Error (122, loc, "'{0}' is inaccessible due to its protection level", expr_type);
return null;
}
Constant c = count as Constant;
// TODO: because we don't have property IsNegative
if (c != null && c.ConvertToUInt () == null) {
- Report.Error (Message.CS0247_Cannot_use_a_negative_size_with_stackalloc, loc);
+ Report.Error (247, loc, "Cannot use a negative size with stackalloc");
return null;
}
string path = Path.GetFullPath (name);
if (source_files.Contains (path)){
- Report.Warning (Message.CS2002_Source_file_specified_multiple_times, name);
+ Report.Warning (2002, name, "Source file '{0}' specified multiple times");
return;
}
foreach (UsingEntry old_entry in using_clauses){
if (old_entry.Name == ns){
- Report.Warning (Message.CS0105_The_using_directive_for_appeared_previously_in_this_namespace, loc, ns);
+ Report.Warning (105, loc, "The using directive for '{0}' appeared previously in this namespace", ns);
return;
}
}
builder.SetMarshal (marshal);
return;
}
- Report.Warning (Message.CS_24_The_Microsoft_Runtime_cannot_set_this_marshal_info, a.Location);
+ Report.Warning (-24, a.Location, "The Microsoft Runtime cannot set this marshal info. Please use the Mono runtime instead.");
return;
}
builder = mb.DefineParameter (0, ParameterAttributes.None, "");
}
catch (ArgumentOutOfRangeException) {
- Report.Warning (Message.CS_28_The_Microsoft_NET_Runtime_does_not_permit_setting_custom_attributes_on_the_return_type, location);
+ Report.Warning (-28, location, "The Microsoft .NET Runtime 1.x does not permit setting custom attributes on the return type");
}
}
namespace Mono.CSharp {
- public enum Message: int {
- CS_24_The_Microsoft_Runtime_cannot_set_this_marshal_info = -24,
- CS_28_The_Microsoft_NET_Runtime_does_not_permit_setting_custom_attributes_on_the_return_type = -28,
- CS0028_The_wrong_signature_to_be_an_entry_point = 28,
- CS0067_The_event_is_never_used = 67,
- CS0072_Event_can_override_only_event = 72,
- CS0078_The_l_suffix_is_easily_confused_with_the_digit_1 = 78,
- CS0105_The_using_directive_for_appeared_previously_in_this_namespace = 105,
- CS0108_The_keyword_new_is_required = 108,
- CS0109_The_member_does_not_hide_an_inherited_member_new_keyword_is_not_required = 109,
- CS0111_Type_already_defines_member_with_the_same_parameter_types = 111,
- CS0114_Hides_inherited_member = 114,
- CS0115_No_suitable_methods_found_to_override = 115,
- CS0122_is_inaccessible_due_to_its_protection_level = 122,
- CS0134_Cannot_use_qualified_namespace_names_in_nested_namespace_declarations = 134,
- CS0145_A_const_field_requires_a_value_to_be_provided = 145,
- CS0160_A_previous_catch_clause_already_catches_all_exceptions_of_this_or_a_super_type = 160,
- CS0162_Unreachable_code_detected = 162,
- CS0168_The_variable_is_declared_but_never_used = 168,
- CS0169_The_private_field_is_never_used = 169,
- CS0183_The_given_expression_is_always_of_the_provided_type = 183,
- CS0184_The_given_expression_is_never_of_the_provided_type = 184,
- CS0210_You_must_provide_an_initializer_in_a_fixed_or_using_statement_declaration = 210,
- CS0219_The_variable_is_assigned_but_its_value_is_never_used = 219,
- CS0243_Conditional_not_valid_on_because_it_is_an_override_method = 243,
- CS0247_Cannot_use_a_negative_size_with_stackalloc = 247,
- CS0415_The_IndexerName_attribute_is_valid_only_on_an_indexer_that_is_not_an_explicit_interface_member_declaration = 415,
- CS0502_cannot_be_both_abstract_and_sealed = 502,
- CS0553_user_defined_conversion_to_from_base_class = 553,
- CS0554_user_defined_conversion_to_from_derived_class = 554,
- CS0577_Conditional_not_valid_on_because_it_is_a_destructor_operator_or_explicit_interface_implementation = 577,
- CS0578_Conditional_not_valid_on_because_its_return_type_is_not_void = 578,
- CS0582_Conditional_not_valid_on_interface_members = 582,
- CS0592_Attribute_is_not_valid_on_this_declaration_type = 592,
- CS0601_The_DllImport_attribute_must_be_specified_on_a_method_marked_static_and_extern = 601,
- CS0609_Cannot_set_the_IndexerName_attribute_on_an_indexer_marked_override = 609,
- CS0610_Field_or_property_cannot_be_of_type = 610,
- CS0612_is_obsolete = 612,
- CS0619_error_is_obsolete = 619,
- CS0618_warning_is_obsolete = 618,
- CS0626_Method_operator_or_accessor_is_marked_external_and_has_no_attributes_on_it = 626,
- CS0628_New_protected_member_declared_in_sealed_class = 628,
- CS0629_Conditional_member_cannot_implement_interface_member = 629,
- CS0633_The_argument_to_the_IndexerName_attribute_must_be_a_valid_identifier = 633,
- CS0642_Possible_mistaken_empty_statement = 642,
- CS0649_Field_is_never_assigned_to_and_will_always_have_its_default_value = 649,
- CS0657_is_not_a_valid_attribute_location_for_this_declaration = 657,
- CS0659_overrides_Equals_but_does_not_override_GetHashCode = 659,
- CS0660_defines_operator_but_does_not_override_Equals = 660,
- CS0661_defines_operator_but_does_not_override_GetHashCode = 661,
- CS0668_Two_indexers_have_different_names = 668,
- CS0672_Member_overrides_obsolete_member = 672,
- CS1030_warning = 1030,
- CS1555_Could_not_find_specified_for_Main_method = 1555,
- CS1556_specified_for_Main_method_must_be_a_valid_class_or_struct = 1556,
- CS1616_Option_overrides_options_given_in_source = 1616,
- CS1618_Cannot_create_delegate_with_because_it_has_a_Conditional_attribute = 1618,
- CS1667_is_not_valid_on_property_or_event_accessors = 1667,
- CS1669__arglist_is_not_valid_in_this_context = 1669,
- CS2002_Source_file_specified_multiple_times = 2002,
- CS3000_Methods_with_variable_arguments_are_not_CLS_compliant = 3000,
- CS3001_Argument_type_is_not_CLS_compliant = 3001,
- CS3002_Return_type_of_is_not_CLS_compliant = 3002,
- CS3003_Type_is_not_CLS_compliant = 3003,
- CS3005_Identifier_differing_only_in_case_is_not_CLS_compliant = 3005,
- CS3006_Overloaded_method_differing_only_in_ref_or_out_or_in_array_rank_is_not_CLS_compliant = 3006,
- CS3008_Identifier_is_not_CLS_compliant = 3008,
- CS3009_base_type_is_not_CLS_compliant = 3009,
- CS3010_CLS_compliant_interfaces_must_have_only_CLScompliant_members = 3010,
- CS3011_only_CLS_compliant_members_can_be_abstract = 3011,
- CS3012_You_must_specify_the_CLSCompliant_attribute_on_the_assembly_not_the_module_to_enable_CLS_compliance_checking = 3012,
- CS3013_Added_modules_must_be_marked_with_the_CLSCompliant_attribute_to_match_the_assembly = 3013,
- CS3014_cannot_be_marked_as_CLS_compliant_because_the_assembly_does_not_have_a_CLSCompliant_attribute = 3014,
- CS3015_has_no_accessible_constructors_which_use_only_CLS_compliant_types = 3015,
- CS3016_Arrays_as_attribute_arguments_are_not_CLS_compliant = 3016,
- CS3019_CLS_compliance_checking_will_not_be_performed_on_because_it_is_private_or_internal = 3019
- }
-
/// <summary>
/// This class is used to report errors and warnings t te user.
/// </summary>
/// </summary>
static StringCollection related_symbols = new StringCollection ();
- abstract class MessageData {
- protected readonly string Message;
-
- public MessageData (string text)
- {
- Message = text;
- }
-
- static void Check (int code)
- {
- if (code == expected_error) {
- Environment.Exit (0);
- }
- }
-
- string Format (params object[] args)
- {
- return String.Format (Message, args);
- }
-
- public abstract string MessageType { get; }
-
- public virtual void Print (Message msg_id, string location, params object[] args)
- {
- int code = (int)msg_id;
-
- if (code < 0)
- code = 8000-code;
-
- string text = Format (args);
- string msg = String.Format ("{0} {1} CS{2:0000}: {3}", location, MessageType, code, text);
- Console.WriteLine (msg);
-
- foreach (string s in related_symbols) {
- Console.WriteLine (s + MessageType + ')');
- }
- related_symbols.Clear ();
-
- if (Stacktrace)
- Console.WriteLine (FriendlyStackTrace (new StackTrace (true)));
-
- if (Fatal)
- throw new Exception (text);
-
- Check (code);
- }
- }
-
- class WarningData: MessageData {
- public WarningData (int level, string text):
- base (text) {
- Level = level;
- }
-
- bool IsEnabled (int code)
- {
- if (RootContext.WarningLevel < Level)
- return false;
-
- if (warning_ignore_table != null) {
- if (warning_ignore_table.Contains (code)) {
- return false;
- }
- }
- return true;
- }
-
- public override void Print(Message msg_id, string location, params object[] args)
- {
- int code = (int)msg_id;
- if (!IsEnabled (code)) {
- related_symbols.Clear ();
- return;
- }
-
- if (WarningsAreErrors) {
- new ErrorData (Message).Print (msg_id, location, args);
- return;
- }
-
- Warnings++;
- base.Print (msg_id, location, args);
- }
-
- public override string MessageType {
- get {
- return "warning";
- }
- }
-
- readonly int Level;
- }
-
- class ErrorData: MessageData {
- public ErrorData (string text):
- base (text)
- {
- }
-
- public override void Print(Message msg, string location, params object[] args)
- {
- Errors++;
- base.Print (msg, location, args);
- }
-
- public override string MessageType {
- get {
- return "error";
- }
- }
-
- }
-
- static MessageData GetErrorMsg (Message msg)
- {
- switch ((int)msg) {
- case -24: return new WarningData (1, "The Microsoft Runtime cannot set this marshal info. Please use the Mono runtime instead.");
- case -28: return new WarningData (1, "The Microsoft .NET Runtime 1.x does not permit setting custom attributes on the return type");
- case 0028: return new WarningData (4, "'{0}' has the wrong signature to be an entry point");
- case 0067: return new WarningData (3, "The event '{0}' is never used");
- case 0072: return new ErrorData ("Event '{0}' can override only event");
- case 0078: return new WarningData (4, "The 'l' suffix is easily confused with the digit '1' (use 'L' for clarity)");
- case 0105: return new WarningData (3, "The using directive for '{0}' appeared previously in this namespace");
- case 0108: return new WarningData (1, "The keyword new is required on '{0}' because it hides inherited member");
- case 0109: return new WarningData (4, "The member '{0}' does not hide an inherited member. The new keyword is not required");
- case 0111: return new ErrorData ("Type '{0}' already defines a member called '{1}' with the same parameter types");
- case 0114: return new WarningData (2, "'{0}' hides inherited member '{1}'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword");
- case 0115: return new ErrorData ("'{0}': no suitable methods found to override");
- case 0122: return new ErrorData ("'{0}' is inaccessible due to its protection level");
- case 0134: return new ErrorData ("Cannot use qualified namespace names in nested namespace declarations");
- case 0145: return new ErrorData ("A const field requires a value to be provided");
- case 0160: return new ErrorData ("A previous catch clause already catches all exceptions of this or a super type '{0}'");
- case 0162: return new WarningData (2, "Unreachable code detected");
- case 0168: return new WarningData (3, "The variable '{0}' is declared but never used");
- case 0169: return new WarningData (3, "The private field '{0}' is never used");
- case 0183: return new WarningData (1, "The given expression is always of the provided ('{0}') type");
- case 0184: return new WarningData (1, "The given expression is never of the provided ('{0}') type");
- case 0210: return new ErrorData ("You must provide an initializer in a fixed or using statement declaration");
- case 0219: return new WarningData (3, "The variable '{0}' is assigned but its value is never used");
- case 0243: return new ErrorData ("Conditional not valid on '{0}' because it is an override method");
- case 0247: return new ErrorData ("Cannot use a negative size with stackalloc");
- case 0415: return new ErrorData ("The 'IndexerName' attribute is valid only on an indexer that is not an explicit interface member declaration");
- case 0502: return new ErrorData ("'{0}' cannot be both abstract and sealed");
- case 0553: return new ErrorData ("'{0}' : user defined conversion to/from base class");
- case 0554: return new ErrorData ("'{0}' : user defined conversion to/from derived class");
- case 0577: return new ErrorData ("Conditional not valid on '{0}' because it is a destructor, operator, or explicit interface implementation");
- case 0578: return new ErrorData ("Conditional not valid on '{0}' because its return new ErrorData ( type is not void");
- case 0582: return new ErrorData ("Conditional not valid on interface members");
- case 0592: return new ErrorData ("Attribute '{0}' is not valid on this declaration type. It is valid on {1} declarations only.");
- case 0601: return new ErrorData ("The DllImport attribute must be specified on a method marked `static' and `extern'");
- case 0609: return new ErrorData ("Cannot set the 'IndexerName' attribute on an indexer marked override");
- case 0610: return new ErrorData ("Field or property cannot be of type '{0}'");
- case 0612: return new WarningData (1, "'{0}' is obsolete");
- case 0618: return new WarningData (2, "'{0}' is obsolete: '{1}'");
- case 0619: return new ErrorData ("'{0}' is obsolete: '{1}'");
- case 0626: return new ErrorData ("Method, operator, or accessor '{0}' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation");
- case 0628: return new WarningData (4, "'{0}': new protected member declared in sealed class");
- case 0629: return new ErrorData ("Conditional member '{0}' cannot implement interface member");
- case 0633: return new ErrorData ("The argument to the 'IndexerName' attribute must be a valid identifier");
- case 0642: return new WarningData (3, "Possible mistaken empty statement");
- case 0649: return new WarningData (4, "Field '{0}' is never assigned to, and will always have its default value '{1}'");
- case 0657: return new ErrorData ("'{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'");
- case 0659: return new WarningData (3, "'{0}' overrides Object.Equals(object) but does not override Object.GetHashCode()");
- case 0660: return new WarningData (3, "'{0}' defines operator == or operator != but does not override Object.Equals(object o)");
- case 0661: return new WarningData (3, "'{0}' defines operator == or operator != but does not override Object.GetHashCode()");
- case 0668: return new ErrorData ("Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type");
- case 0672: return new WarningData (1, "Member '{0}' overrides obsolete member. Add the Obsolete attribute to '{0}'");
- case 1030: return new WarningData (1, "#warning: '{0}'");
- case 1555: return new ErrorData ("Could not find '{0}' specified for Main method");
- case 1556: return new ErrorData ("'{0}' specified for Main method must be a valid class or struct");
- case 1616: return new WarningData (1, "Compiler option '{0}' overrides '{1}' given in source");
- case 1618: return new ErrorData ("Cannot create delegate with '{0}' because it has a Conditional attribute");
- case 1667: return new ErrorData ("'{0}' is not valid on property or event accessors. It is valid on '{1}' declarations only");
- case 1669: return new ErrorData ("__arglist is not valid in this context");
- case 2002: return new WarningData (1, "Source file '{0}' specified multiple times");
- case 3000: return new ErrorData ("Methods with variable arguments are not CLS-compliant");
- case 3001: return new ErrorData ("Argument type '{0}' is not CLS-compliant");
- case 3002: return new ErrorData ("Return type of '{0}' is not CLS-compliant");
- case 3003: return new ErrorData ("Type of '{0}' is not CLS-compliant");
- case 3005: return new ErrorData ("Identifier '{0}' differing only in case is not CLS-compliant");
- case 3006: return new ErrorData ("Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant");
- case 3008: return new ErrorData ("Identifier '{0}' is not CLS-compliant");
- case 3009: return new ErrorData ("'{0}': base type '{1}' is not CLS-compliant");
- case 3010: return new ErrorData ("'{0}': CLS-compliant interfaces must have only CLS-compliant members");
- case 3011: return new ErrorData ("'{0}': only CLS-compliant members can be abstract");
- case 3012: return new WarningData (1, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
- case 3013: return new ErrorData ("Added modules must be marked with the CLSCompliant attribute to match the assembly");
- case 3014: return new ErrorData ("'{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute");
- case 3015: return new ErrorData ("'{0}' has no accessible constructors which use only CLS-compliant types");
- case 3016: return new ErrorData ("Arrays as attribute arguments are not CLS-compliant");
- case 3019: return new WarningData (2, "CLS compliance checking will not be performed on '{0}' because it is private or internal");
- }
- throw new InternalErrorException (String.Format ("Missing message '{0}' text", msg));
- }
-
static void Check (int code)
{
if (code == expected_error){
}
- /// <summary>
- /// Method reports warning message. Only one reason why exist Warning and Report methods is beter code readability.
- /// </summary>
- static public void Warning (Message msg, Location loc, params object[] args)
- {
- MessageData md = GetErrorMsg (msg);
- md.Print (msg, String.Format ("{0}({1})", loc.Name, loc.Row), args);
- }
-
- static public void Warning (Message msg, params object[] args)
- {
- MessageData md = GetErrorMsg (msg);
- md.Print (msg, "", args);
- }
-
- /// <summary>
- /// Reports error message. This is preferred method because it supports future localization
- /// </summary>
- static public void Error (Message msg, Location loc, params object[] args)
- {
- Error (msg, String.Format ("{0}({1})", loc.Name, loc.Row), args);
- }
-
- static public void Error (Message msg, string location, params object[] args)
- {
- MessageData md = GetErrorMsg (msg);
- md.Print (msg, location, args);
- }
-
- //[Obsolete ("Use Error with Message parameter")]
static public void Error (int code, Location l, string text)
{
if (code < 0)
Check (code);
}
-// [Obsolete ("Use Warning with Message parameter")]
static public void Warning (int code, Location l, string text)
{
if (code < 0)
}
}
-// [Obsolete ("Use Warning with Message parameter")]
static public void Warning (int code, string text)
{
Warning (code, Location.Null, text);
}
- //[Obsolete ("Use Error with Message parameter")]
static public void Error (int code, string text)
{
if (code < 0)
code = 8000-code;
string msg = String.Format ("error CS{0:0000}: {1}", code, text);
-// string msg = String.Format ("error CS{0}: {1}", code, text);
-
+
RealError (msg);
Check (code);
}
- //[Obsolete ("Use Error with Message parameter")]
+ static public void Error (int code, string format, params object[] args)
+ {
+ Error (code, Location.Null, String.Format (format, args));
+ }
+
static public void Error (int code, Location loc, string format, params object[] args)
{
Error (code, loc, String.Format (format, args));
}
+ static public void Warning (int code, string format, params object[] args)
+ {
+ Warning (code, Location.Null, String.Format (format, args));
+ }
+
+ static public void Warning (int code, Location loc, string format, params object[] args)
+ {
+ Warning (code, loc, String.Format (format, args));
+ }
+
static public void SetIgnoreWarning (int code)
{
if (warning_ignore_table == null)
return false;
if (warn)
- Report.Warning (Message.CS0162_Unreachable_code_detected, loc);
+ Report.Warning (162, loc, "Unreachable code detected");
return true;
}
name = (string) de.Key;
if (vector.IsAssigned (vi.VariableInfo)){
- Report.Warning (Message.CS0219_The_variable_is_assigned_but_its_value_is_never_used, vi.Location, name);
+ Report.Warning (219, vi.Location, "The variable '{0}' is assigned but its value is never used", name);
} else {
- Report.Warning (Message.CS0168_The_variable_is_declared_but_never_used, vi.Location, name);
+ Report.Warning (168, vi.Location, "The variable '{0}' is declared but never used", name);
}
}
}
Type resolvedType = c.CatchType;
for (int ii = 0; ii < last_index; ++ii) {
if (resolvedType.IsSubclassOf (prevCatches [ii])) {
- Report.Error (Message.CS0160_A_previous_catch_clause_already_catches_all_exceptions_of_this_or_a_super_type, c.loc, prevCatches [ii].FullName);
+ Report.Error (160, c.loc, "A previous catch clause already catches all exceptions of this or a super type '{0}'", prevCatches [ii].FullName);
return false;
}
}