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

Issue 9451 - Better diagnostic on unimplemented abstract methods. #1620

Merged
merged 2 commits into from Mar 18, 2013
Merged

Issue 9451 - Better diagnostic on unimplemented abstract methods. #1620

merged 2 commits into from Mar 18, 2013

Conversation

ghost
Copy link

@ghost ghost commented Feb 4, 2013

@ghost
Copy link
Author

ghost commented Feb 5, 2013

Guys would it be ok if I changed verrorSupplemental to only add 2 spaces instead of the current 7? It's unnecessary to have this much space, especially when errors are printed to the console.

@yebblies
Copy link
Member

yebblies commented Feb 5, 2013

The idea is that they line up with normal errors, making it easier to skip them.

@ghost ghost closed this Feb 5, 2013
@ghost
Copy link
Author

ghost commented Feb 5, 2013

I'm closing temporarily as I want to refactor the code so it's used for both abstract (current pull) and interface functions (#1523).

@ghost ghost reopened this Feb 5, 2013
@ghost
Copy link
Author

ghost commented Feb 5, 2013

Ok I've fixed up Pull 2452 so now both interface and abstract functions use the same diagnostic.

@@ -666,6 +666,7 @@ struct FuncDeclaration : Declaration
void appendState(Statement *s);
char *mangle(bool isv = false);
const char *toPrettyChars();
const char *toFullSignature(); // for diagnostics, e.g. '@pure foo(int x, int y)'
Copy link
Contributor

Choose a reason for hiding this comment

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

More correct example is better: e.g. 'int foo(int x, int y) pure'

@ghost
Copy link
Author

ghost commented Feb 6, 2013

Updated.

}

class C : I
{
void f(int p) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the original test case has an intent as follows: "if derived class actually implements abstract method, compiler does not report error for it." So, this looks to me to make original test case a bit weaken.

Copy link
Author

Choose a reason for hiding this comment

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

I can't clearly understand what you mean, do you want me to revert the test-case to what it was before and just change TEST_OUTPUT? Also this test is about interface methods, not abstract methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

No. This is just a nitpick. What I mean is:
If class C implements f2(int), the error message "void f2(int) is not implemented" should not appear, but "void f2(float) const is not implemented" should.
That was well tested in original case, but you removed it.

To realize it, you can add only void f2(int p) {} in class C, and fix the diagnostic message according to it.

Copy link
Member

Choose a reason for hiding this comment

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

Was this done?

@ghost
Copy link
Author

ghost commented Mar 3, 2013

Let me do a quick modification so functions are wrapped inside of quotes.

@ghost ghost closed this Mar 3, 2013
@ghost ghost reopened this Mar 4, 2013
@ghost
Copy link
Author

ghost commented Mar 4, 2013

Waiting for green.

@ghost
Copy link
Author

ghost commented Mar 5, 2013

@9rnsr
Copy link
Contributor

9rnsr commented Mar 18, 2013

LGTM.

9rnsr added a commit that referenced this pull request Mar 18, 2013
Issue 9451 - Better diagnostic on unimplemented abstract methods.
@9rnsr 9rnsr merged commit d59eee4 into dlang:master Mar 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants