Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to review existing diagnostics in light of records #45207

Closed
jcouv opened this issue Jun 15, 2020 · 0 comments · Fixed by #46341
Closed

Need to review existing diagnostics in light of records #45207

jcouv opened this issue Jun 15, 2020 · 0 comments · Fixed by #46341
Labels
Area-Compilers Bug Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it New Language Feature - Records Records
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Jun 15, 2020

Scanning through existing error messages, I see a few that invite some changes for records.

We'll have a few options to consider for each case:

  • leave as-is
  • fix wording (maybe use "reference type" or "class or record" instead of "class"
  • add special handling (with test) involving record

We'll probably want to start with a couple, just to make sure we have agreement on how to generally handle, before handling the whole set.

  <data name="ERR_BadVisBaseClass" xml:space="preserve">
    <value>Inconsistent accessibility: base class '{1}' is less accessible than class '{0}'</value>
  </data>
  <data name="WRN_NewRequired_Description" xml:space="preserve">
    <value>A variable was declared with the same name as a variable in a base class. However, the new keyword was not used. This warning informs you that you should use new; the variable is declared as if new had been used in the declaration.</value>
  </data>
  <data name="ERR_NoNewAbstract" xml:space="preserve">
    <value>Cannot create an instance of the abstract class or interface '{0}'</value>
  </data>
  <data name="ERR_CircularBase" xml:space="preserve">
    <value>Circular base class dependency involving '{0}' and '{1}'</value>
  </data>
  <data name="ERR_NoBaseClass" xml:space="preserve">
    <value>A base class is required for a 'base' reference</value>
  </data>
  <data name="ERR_CallingBaseFinalizeDeprecated" xml:space="preserve">
    <value>Do not directly call your base class Finalize method. It is called automatically from your destructor.</value>
  </data>
  <data name="ERR_PartialMultipleBases" xml:space="preserve">
    <value>Partial declarations of '{0}' must not specify different base classes</value>
  </data>
  <data name="ERR_PartialMisplaced" xml:space="preserve">
    <value>The 'partial' modifier can only appear immediately before 'class', 'struct', 'interface', or 'void'</value>
  </data>
  <data name="ERR_ImportedCircularBase" xml:space="preserve">
    <value>Imported type '{0}' is invalid. It contains a circular base class dependency.</value>
  </data>
  <data name="ERR_AttributeCantBeGeneric" xml:space="preserve">
    <value>Cannot apply attribute class '{0}' because it is generic</value>
  </data>
  <data name="ERR_AbstractSealedStatic" xml:space="preserve">
    <value>'{0}': an abstract class cannot be sealed or static</value>
  </data>
  <data name="ERR_ComImportWithBase" xml:space="preserve">
    <value>'{0}': a class with the ComImport attribute cannot specify a base class</value>
  </data>
  <data name="ERR_SealedStaticClass" xml:space="preserve">
    <value>'{0}': a class cannot be both static and sealed</value>
  </data>
  <data name="WRN_FinalizeMethod_Description" xml:space="preserve">
    <value>This warning occurs when you create a class with a method whose signature is public virtual void Finalize.

If such a class is used as a base class and if the deriving class defines a destructor, the destructor will override the base class Finalize method, not Finalize.</value>
  </data>
   <data name="ERR_AbstractInConcreteClass" xml:space="preserve">
    <value>'{0}' is abstract but it is contained in non-abstract class '{1}'</value>
  </data>
  <data name="ERR_ExplicitInterfaceImplementationInNonClassOrStruct" xml:space="preserve">
    <value>'{0}': explicit interface declaration can only be declared in a class, struct or interface</value>
  </data>
  <data name="ERR_NewVirtualInSealed" xml:space="preserve">
    <value>'{0}' is a new virtual member in sealed class '{1}'</value>
  </data>
  <data name="ERR_ConversionWithBase" xml:space="preserve">
    <value>'{0}': user-defined conversions to or from a base class are not allowed</value>
  </data>
  <data name="ERR_ConversionWithDerived" xml:space="preserve">
    <value>'{0}': user-defined conversions to or from a derived class are not allowed</value>
  </data>
   <data name="ERR_BadDestructorName" xml:space="preserve">
    <value>Name of destructor must match name of class</value>
  </data>
  <data name="ERR_OnlyClassesCanContainDestructors" xml:space="preserve">
    <value>Only class types can contain destructors</value>
  </data>
  <data name="WRN_ProtectedInSealed" xml:space="preserve">
    <value>'{0}': new protected member declared in sealed class</value>
  </data>
  <data name="WRN_ProtectedInSealed_Title" xml:space="preserve">
    <value>New protected member declared in sealed class</value>
  </data>
   <data name="ERR_AttributeUsageOnNonAttributeClass" xml:space="preserve">
    <value>Attribute '{0}' is only valid on classes derived from System.Attribute</value>
  </data>
  <data name="ERR_AbstractAttributeClass" xml:space="preserve">
    <value>Cannot apply attribute class '{0}' because it is abstract</value>
  </data>
  <data name="ERR_ComImportWithUserCtor" xml:space="preserve">
    <value>A class with the ComImport attribute cannot have a user-defined constructor</value>
  </data>
  <data name="ERR_GenericDerivingFromAttribute" xml:space="preserve">
    <value>A generic type cannot derive from '{0}' because it is an attribute class</value>
  </data>
  <data name="ERR_BadBoundType" xml:space="preserve">
    <value>'{0}' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.</value>
  </data>

I stopped scanning for usages of "class" at line 2000 in the resource file

@jcouv jcouv added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Area-Compilers Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. New Language Feature - Records Records labels Jun 15, 2020
@jcouv jcouv added this to the Compiler.Net5 milestone Jun 15, 2020
@jaredpar jaredpar added the Bug label Jun 22, 2020
@jaredpar jaredpar modified the milestones: Compiler.Net5, 16.8 Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Concept-Diagnostic Clarity The issues deals with the ease of understanding of errors and warnings. help wanted The issue is "up for grabs" - add a comment if you are interested in working on it New Language Feature - Records Records
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants