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

Track expanded support for more multi-location diagnostic messages #22789

Open
11 of 52 tasks
mhegazy opened this issue Mar 22, 2018 · 4 comments
Open
11 of 52 tasks

Track expanded support for more multi-location diagnostic messages #22789

mhegazy opened this issue Mar 22, 2018 · 4 comments
Labels
Domain: Error Messages The issue relates to error messaging Domain: Related Error Spans Specifying regions for error messages/diagnostics on multiple locations. Meta-Issue An issue about the team, or the direction of TypeScript

Comments

@mhegazy
Copy link
Contributor

mhegazy commented Mar 22, 2018

We now support related information for diagnostic messages. This issue now tracks, in aggregate, which diagnostics we have extra information for. The following errors are candidates:

MVP

  • _____ used before its declaration.
  • Property '{0}' is used before being assigned.
  • Cannot redeclare block-scoped variable '{0}'.
  • Type '{0}' is not assignable to type '{1}'.
  • Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.
  • Expected {0} arguments, ___________

Others

  • Cannot find name '{0}'. Did you mean ______

  • Duplicate declaration '{0}'.

  • _____ has or is using private name '{1}'

  • Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.

  • '{0}' are specified twice. The attribute named '{0}' will be overwritten.

  • 'get' and 'set' accessor must have the same type.

  • Accessors must both be abstract or non-abstract.

  • Overload signatures must all be ______

  • Overload signature is not compatible with function implementation.

  • Individual declarations in merged declaration '{0}' must be all exported or all local.

  • Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.

  • Subtyping

    • Class '{0}' incorrectly extends base class '{1}'.
    • Class static side '{0}' incorrectly extends base class static side '{1}'.
    • Class '{0}' incorrectly implements interface '{1}'.
    • Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.
    • Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.
    • Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.
    • Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.
    • Interface '{0}' incorrectly extends interface '{1}'.
    • Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.
    • Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.
  • All declarations of '{0}' must have identical type parameters.

  • In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.

  • Namespace merging

    • A namespace declaration cannot be in a different file from a class or function with which it is merged.
    • A namespace declaration cannot be located prior to a class or function with which it is merged.
  • Module '{0}' is hidden by a local declaration with the same name.

    • should probably be changed to "namespace"
  • Types have separate declarations of a private property '{0}'.

  • Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.

  • Property '{0}' is protected in type '{1}' but public in type '{2}'.

  • An AMD module cannot have multiple name assignments.

  • Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'

  • Export declaration conflicts with exported declaration of '{0}'.

  • Cannot redeclare identifier '{0}' in catch clause.

  • Module '{0}' uses 'export =' and cannot be used with 'export *'.

  • Base constructors must all have the same return type.

  • Overload signatures must all be abstract or non-abstract.

  • A module cannot have multiple default exports.

  • Type '{0}' has no properties in common with type '{1}'.

  • Base class expressions cannot reference class type parameters.

  • A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.

  • '{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.

  • All declarations of '{0}' must have identical modifiers.
    Bonus?

  • A computed property name cannot reference a type parameter from its containing type.

  • Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.

Original Post:

Often a diagnostic message can have additional location information. it is specially helpful in IDE's where clicking on the location can take you there. For instance

  • duplicate declaration errors, can have the other locations where the name was re-declared
  • type x not assignable to type y, a reference to where the target symbol's type is defined
  • implicit any errors, have a reference to the declaration of the container type
  • parameter type/number mismatch, have a reference tot he function declaration

VSCode is adding support for exposing a list of related diagnostics in microsoft/vscode#1927.

We can also expose this in --pretty.

@mhegazy mhegazy added the Suggestion An idea for TypeScript label Mar 22, 2018
@mhegazy mhegazy added this to the TypeScript 2.9 milestone Mar 22, 2018
@mjbvz
Copy link
Contributor

mjbvz commented Mar 22, 2018

Here's the current vscode API for this: https://github.com/Microsoft/vscode/blob/32bdb4663258bf34228b007e7858ae6c91e5beb9/src/vs/vscode.d.ts#L3682

/ cc @DanielRosenwasser

@DanielRosenwasser DanielRosenwasser added the Domain: Error Messages The issue relates to error messaging label Mar 22, 2018
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Mar 22, 2018

<moved the checklist into the OP>

@DanielRosenwasser
Copy link
Member

P.S. is this a duplicate of #10489?

@DanielRosenwasser DanielRosenwasser added the Domain: Related Error Spans Specifying regions for error messages/diagnostics on multiple locations. label Jun 26, 2018
@mhegazy mhegazy added the Meta-Issue An issue about the team, or the direction of TypeScript label Jul 2, 2018
@mhegazy mhegazy removed this from the TypeScript 3.0 milestone Jul 2, 2018
@weswigham weswigham removed the Suggestion An idea for TypeScript label Nov 6, 2018
@weswigham weswigham changed the title Add support for multi-location diagnostic messages Track expanded support for more multi-location diagnostic messages Nov 6, 2018
@weswigham
Copy link
Member

I've revised the OP of the issue to track which errors we have additional spans for out of @DanielRosenwasser 's big list. @DanielRosenwasser you care to mark any I've missed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Domain: Related Error Spans Specifying regions for error messages/diagnostics on multiple locations. Meta-Issue An issue about the team, or the direction of TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants