-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Changes from all commits
666284d
7fcf45c
65c12a2
e896a66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7868,14 +7868,38 @@ public: | |
| // goto L1; | ||
| } | ||
| } | ||
| s = sym.search(e.loc, ident); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 searchSym() | ||
| { | ||
| int flags = 0; | ||
| Dsymbol sold = void; | ||
| if (global.params.bug10378 || global.params.check10378) | ||
| { | ||
| sold = sym.search(e.loc, ident, flags); | ||
| if (!global.params.check10378) | ||
| return sold; | ||
| } | ||
|
|
||
| auto s = sym.search(e.loc, ident, flags | SearchLocalsOnly); | ||
| if (global.params.check10378) | ||
| { | ||
| alias snew = s; | ||
| if (sold !is snew) | ||
| Scope.deprecation10378(e.loc, sold, snew); | ||
| if (global.params.bug10378) | ||
| s = sold; | ||
| } | ||
| return s; | ||
| } | ||
|
|
||
| s = searchSym(); | ||
| L1: | ||
| if (!s) | ||
| { | ||
| if (sym._scope) // it's a fwd ref, maybe we can resolve it | ||
| { | ||
| sym.semantic(null); | ||
| s = sym.search(e.loc, ident); | ||
| s = searchSym(); | ||
| } | ||
| if (!s) | ||
| return noMember(sc, e, ident, flag); | ||
|
|
@@ -8639,7 +8663,31 @@ public: | |
| sc2.pop(); | ||
| return e; | ||
| } | ||
| s = sym.search(e.loc, ident); | ||
|
|
||
| Dsymbol searchSym() | ||
| { | ||
| int flags = 0; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to declare flags here, just use 0 and SearchLocalsOnly directly. |
||
| Dsymbol sold = void; | ||
| if (global.params.bug10378 || global.params.check10378) | ||
| { | ||
| sold = sym.search(e.loc, ident, flags); | ||
| if (!global.params.check10378) | ||
| return sold; | ||
| } | ||
|
|
||
| auto s = sym.search(e.loc, ident, flags | SearchLocalsOnly); | ||
| if (global.params.check10378) | ||
| { | ||
| alias snew = s; | ||
| if (sold !is snew) | ||
| Scope.deprecation10378(e.loc, sold, snew); | ||
| if (global.params.bug10378) | ||
| s = sold; | ||
| } | ||
| return s; | ||
| } | ||
|
|
||
| s = searchSym(); | ||
| L1: | ||
| if (!s) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module imports.a15856; | ||
|
|
||
| alias int c_long; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // REQUIRED_ARGS: -transition=checkimports -de | ||
| // PERMUTE_ARGS: | ||
| /* | ||
| TEST_PUTPUT: | ||
| --- | ||
| --- | ||
| */ | ||
|
|
||
| class Foo | ||
| { | ||
| import imports.a15856; | ||
|
|
||
| struct Bar | ||
| { | ||
| c_long a; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,11 @@ | |
| /* | ||
| TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/checkimports2c.d(20): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X | ||
| fail_compilation/checkimports2c.d(29): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the test case, those don't seem very clear. Other suggestions welcome, but "found X instead of nothing" is not user friendly. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| fail_compilation/checkimports2c.d(31): Deprecation: local import search method found variable imports.imp2.X instead of variable checkimports2c.X | ||
| fail_compilation/checkimports2c.d(32): Deprecation: local import search method found variable imports.imp2.Y instead of variable imports.imp1.Y | ||
| --- | ||
| */ | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated