Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 05, 2009 [Issue 3301] New: Import statements are order dependent; should be order independent | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3301 Summary: Import statements are order dependent; should be order independent Product: D Version: 2.032 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: sandford@jhu.edu In DMD 2.032, the order of import statements seems to be important. Specifically, with regard to cyclic import statements. Below is a simple test case using two files winapi.d and wincom.d module winapi; public import wincom; // If the import is here, winapi does not compile public import std.c.windows.windows; //public import wincom; // If the import is here, winapi compiles alias HRESULT THEMEAPI; module wincom; public import winapi; public import std.c.windows.com; HRESULT hresult; When compiling winapi, wincom errors are generated: wincom.d(6): Error: identifier 'HRESULT' is not defined wincom.d(6): Error: HRESULT is used as a type wincom.d(6): Error: variable wincom.hresult voids have no value -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 05, 2009 [Issue 3301] Import statements are order dependent; should be order independent | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 simon <s.d.hammett@googlemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |s.d.hammett@googlemail.com --- Comment #1 from simon <s.d.hammett@googlemail.com> 2009-09-05 04:32:03 PDT --- It's worth noting that when this happens you can still access the stuff in the imported module by using the fully qualified name. The bug is effectively causing the imports to be imported as static. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 05, 2009 [Issue 3301] Import statements are order dependent; should be order independent | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 --- Comment #2 from Rob Jacques <sandford@jhu.edu> 2009-09-05 08:51:34 PDT --- (In reply to comment #1) > It's worth noting that when this happens you can still access the stuff in the imported module by using the fully qualified name. The bug is effectively causing the imports to be imported as static. Although that's true of the test case, there were other examples in DFL where the fully qualified name was being used and it was still not accessible. So in practice, the FQN doesn't solve the whole problem, but this may be a different bug. (It's just that those examples were a lot more complicated. I'm specifically thinking of the use of classes from data.d in control.d) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 05, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 Stewart Gordon <smjg@iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Blocks| |340 Summary|Import statements are order |Undefined identifier error |dependent; should be order |dependent on order of |independent |imports when a circular | |import is involved --- Comment #3 from Stewart Gordon <smjg@iname.com> 2009-09-05 16:39:15 PDT --- It appears that this could be related to issue 258. How it found a line 6 in wincom.d is another mystery. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 --- Comment #4 from simon <s.d.hammett@googlemail.com> 2009-09-05 17:56:54 PDT --- Possibly, but my code compiles fine in 2.028 & 2.031. I've made no changes at all in my code and now it's foo barred w/ 2.032. So (obv.) some difference in the 2.032 change set has exacerbated this bug. Given how much stuff got done, that's probably not going to help much though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 --- Comment #5 from simon <s.d.hammett@googlemail.com> 2009-09-05 18:19:35 PDT --- (In reply to comment #4) > Possibly, but my code compiles fine in 2.028 & 2.031. > I've made no changes at all in my code and now it's foo barred w/ 2.032. > > So (obv.) some difference in the 2.032 change set has exacerbated this bug. Given how much stuff got done, that's probably not going to help much though. Sry, ignore the bit about 2.031. That's foo barred as well, but that might be phobos issues. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 --- Comment #6 from Stewart Gordon <smjg@iname.com> 2009-09-05 18:32:29 PDT --- I'm getting the same errors for the testcases here in 1.046, 1.047, 2.031 and 2.032 alike. Though in all cases, the errors are reported at wincom.d(4). ---------- C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c wincom.d C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c winapi.d wincom.d(4): Error: identifier 'HRESULT' is not defined wincom.d(4): Error: HRESULT is used as a type wincom.d(4): Error: variable wincom.hresult voids have no value C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c wincom.d winapi.d C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c winapi.d wincom.d wincom.d(4): Error: identifier 'HRESULT' is not defined wincom.d(4): Error: HRESULT is used as a type wincom.d(4): Error: variable wincom.hresult voids have no value -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P1 CC| |braddr@puremagic.com --- Comment #7 from Brad Roberts <braddr@puremagic.com> 2009-09-06 13:36:20 PDT --- Bumping up to a P1 bug. Walter, this needs to be at least commented upon asap. It's a rather nasty regression. For the rest of you, a standalone repro case would likely help. The one from the original problem description requires importing std.c.windows.windows which itself is rather huge. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 06, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 --- Comment #8 from Stewart Gordon <smjg@iname.com> 2009-09-06 16:39:24 PDT --- I'm not sure how trimming it down can be that difficult.... ----- bz3301.d ----- public import bz3301a; public import bz3301b; ----- bz3301a.d ----- public import bz3301; HRESULT hresult; ----- bz3301b.d ----- alias int HRESULT; ---------- C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd -c bz3301.d bz3301a.d(2): Error: identifier 'HRESULT' is not defined bz3301a.d(2): Error: HRESULT is used as a type bz3301a.d(2): Error: variable bz3301a.hresult voids have no value ---------- (1.047) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 11, 2009 [Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved | ||||
---|---|---|---|---|
| ||||
Posted in reply to sandford@jhu.edu | http://d.puremagic.com/issues/show_bug.cgi?id=3301 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #9 from Walter Bright <bugzilla@digitalmars.com> 2009-09-11 11:54:59 PDT --- Thanks for doing a small test case. This problem has actually always been there. I don't know why it didn't show up earlier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation