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

Use related error spans for "implement abstract class" errors #35076

Closed
wants to merge 1 commit into from
Closed

Use related error spans for "implement abstract class" errors #35076

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 13, 2019

Fixes #32848

I combine messages using chainDiagnosticMessages.
But I cannot sure this is really good.
Can you give me some opinion?

cc @DanielRosenwasser @mjbvz @crc442

@ghost ghost changed the title combine not implemented member messages Use related error spans for "implement abstract class" errors Nov 13, 2019
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'.
~
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'readonlyProp' from class 'B'.
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I was implementing towards

!!! error TS<NEWCODE>: Non-abstract class 'C' does not implement every abstract members of class 'B'
!!! error TS<NEWCODE>:   Class 'C' is missing the following member implementations from class 'B': prop, readonlyprop, m
  • new generic error with details in span

Copy link

@crc442 crc442 Nov 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if this implementation works for us, I'll stop what I am doing; else I should be able to finish in a day or two

Copy link
Author

@ghost ghost Nov 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your message is more suitable for the proposal.

Proposal
Instead of generating two errors in this case, generate a single, generic diagnostic that states > something like: B does not implement all abstract members of A and on that diagnostic return > related spans that state specifically which members are not implemented (b and c).

Please let us know your worked branch and let's ask to @DanielRosenwasser

@ghost ghost closed this Dec 25, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use related error spans for "implement abstract class" errors
1 participant