Skip to content

Add new error message when class implements class#19797

Merged
DanielRosenwasser merged 2 commits into
microsoft:masterfrom
charlespierce:implements_class_error_message
Dec 19, 2017
Merged

Add new error message when class implements class#19797
DanielRosenwasser merged 2 commits into
microsoft:masterfrom
charlespierce:implements_class_error_message

Conversation

@charlespierce
Copy link
Copy Markdown
Contributor

Fixes #19793

Added new diagnostic message for when a class incorrectly implements another class. Also added that diagnostic to the errorCodes list for the fixClassIncorrectlyImplementsInterface CodeFix

Comment thread src/compiler/diagnosticMessages.json Outdated
"category": "Error",
"code": 2716
},
"Class '{0}' is declared to implement class '{1}'. Did you mean 'extends'?": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i would rather this stayed class '{0}' incorrectly implements class '{1}'. Did you mean 'extends'?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@DanielRosenwasser thoughts about this one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can make a quick change to that effect, I was just using the error message from the issue description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@charlespierce charlespierce force-pushed the implements_class_error_message branch from 540f322 to 02b8b5b Compare November 17, 2017 04:58
@charlespierce
Copy link
Copy Markdown
Contributor Author

PR Updated to resolve merge conflicts.

Comment thread src/compiler/diagnosticMessages.json Outdated
"category": "Error",
"code": 2718
},
"Class '{0}' incorrectly implements class '{1}'. Did you mean 'extends'?": {
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser Nov 17, 2017

Choose a reason for hiding this comment

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

I'd prefer if the phrasing was more a little more specific on what's being discussed. Maybe something more like:

Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?

Thoughts @mhegazy?

@charlespierce
Copy link
Copy Markdown
Contributor Author

@DanielRosenwasser @mhegazy Any remaining concerns with this PR?

@charlespierce charlespierce force-pushed the implements_class_error_message branch from 2fa256e to 472f087 Compare December 6, 2017 05:19
@charlespierce charlespierce reopened this Dec 6, 2017
@charlespierce
Copy link
Copy Markdown
Contributor Author

@mhegazy @DanielRosenwasser Updated to resolve conflicts in diagnosticMessages.json

@DanielRosenwasser DanielRosenwasser merged commit 69e091b into microsoft:master Dec 19, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when implements is used instead of extends

4 participants