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 15856 - Confusing error message with -transition=checkimports #5651

Merged
merged 4 commits into from May 3, 2016

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Apr 12, 2016

Improve deprecation message mechanism for next minor release 2.071.1.

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
15856 Confusing error message with -transition=checkimports

@WalterBright
Copy link
Member

Do we really need to change 19 files to change a message? Something seems wrong.

@dnadlinger
Copy link
Member

@MartinNowak: Could you have a short look at this?

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 13, 2016

Do we really need to change 19 files to change a message? Something seems wrong.

Yes we must fix the unsync between C++ headers and D declarations that was introduced in #5445. It's definitely wrong, because when a search function is used from both C++ and D code, the mismatch would cause different symbol search behaviors.

Today, Scope.search is actually used in iasm.c. Fortunately it has introduced no bugs, but the dangerous problem should be fixed ASAP.

fail_compilation/checkimports2c.d(30): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y
fail_compilation/checkimports2c.d(22): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X
fail_compilation/checkimports2c.d(28): Deprecation: local import search method found variable imports.imp2.X instead of nothing
fail_compilation/checkimports2c.d(29): Deprecation: local import search method found variable imports.imp2.Y instead of nothing
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the test case, those don't seem very clear.
Could we have something that isn't refering to the compiler internal, e.g:
Deprecation: Variable imports.imp2.Y introduced by a private local import is not visible with the new import rule, use a public import or an alias ?

Other suggestions welcome, but "found X instead of nothing" is not user friendly.

Copy link
Member

Choose a reason for hiding this comment

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

We don't know through which import we found the symbol, and it would be too much work to figure out.

@WalterBright
Copy link
Member

Yes we must fix the unsync between C++ headers and D declarations that was introduced in #5445. It's definitely wrong, because when a search function is used from both C++ and D code, the mismatch would cause different symbol search behaviors.

This appears to be a separate issue from fixing a confusing error message. Hence, it should go in a separate PR.

Please, please, have only one issue per PR. Do not lump multiple things together. I've posted the reasons at least a dozen times. I don't think there's any risk of overflowing the PR # counter :-)

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 13, 2016

@WalterBright Done. #5657

@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 13, 2016

When I've started to fix issue 15856, the default argument mismatch had blocked to change the default arguments to tweak search method in some places. Fortunately the final change didn't need that method, but it's still a serious bug, and related with the search code. That's why I put the commit in this PR.

@9rnsr 9rnsr force-pushed the fix15856 branch 3 times, most recently from 6f650ff to b77b092 Compare April 17, 2016 23:21
* Add -transition=chekcimporrts logic in Type(Struct|Class).dotExp
* Stop confusing deprecation message "... found in local import" message in ScopeDsymbol.search

Dsymbol searchSym()
{
int flags = 0;
Copy link
Member

Choose a reason for hiding this comment

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

No need to declare flags here, just use 0 and SearchLocalsOnly directly.

@MartinNowak
Copy link
Member

This also seems to fix Issue 15897 – private base class method not seen through derived class like my PR #5727, true?

@@ -7868,14 +7868,38 @@ public:
// goto L1;
}
}
s = sym.search(e.loc, ident);
Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think we should get rid of the default flags for Dsymbol.search. They even differ for Dsymbol and ScopeDSymbol :o.

@MartinNowak
Copy link
Member

Do we really need to change 19 files to change a message? Something seems wrong.

It's changing 6 files, a few headers and tests. And it also adds the old vs. new import check to TypeClass and TypeStruct. Seems fairly reasonable to me.

else
{
flags |= SearchLocalsOnly;
}
Copy link
Member

Choose a reason for hiding this comment

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

Rather do

if (!(flags & (SearchLocalsOnly | SearchImportsOnly))
    flags |= SearchLocalsOnly;

@MartinNowak
Copy link
Member

I've put my comments into a PR 9rnsr#6.

@9rnsr
Copy link
Contributor Author

9rnsr commented May 3, 2016

I merged 9rnsr#6, and then fixed a breaking introduced by it.

@MartinNowak MartinNowak merged commit c5a5758 into dlang:stable May 3, 2016
@9rnsr 9rnsr deleted the fix15856 branch May 12, 2016 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants