[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3301

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|2.032   |D2

--


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-10-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #16 from Walter Bright bugzi...@digitalmars.com 2009-10-13 
13:47:26 PDT ---
Fixed dmd 1.049 and 2.034

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-10-03 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Rainer Schuetze r.sagita...@gmx.de changed:

   What|Removed |Added

 Attachment #454 is|0   |1
   obsolete||


--- Comment #15 from Rainer Schuetze r.sagita...@gmx.de 2009-10-03 08:28:17 
PDT ---
Created an attachment (id=469)
improved patch with version/debug support

I have improved the patch to look through version/debug conditionals, that
would bring back all the troubles if used for the imports.

I've also moved the setScope calls into the importAll functions, which was
already proposed in a comment nearby. At the same time, version/debug
conditional declarations pass the scope to its included branch.
StaticIfDeclarations cannot do this, because the semantic analysis is needed to
evaluate the condition.

In the long run, I'd propose to take the setScope mechanism further, setting
the scope as early as possible, allowing semantic analysis in arbitrary order.

I've run the qtd build with this patch and it still works. You'll also need the
patch of issue 3353 for the build to complete, though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-26 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Tim M tim.matthe...@gmail.com changed:

   What|Removed |Added

 CC||tim.matthe...@gmail.com


--- Comment #14 from Tim M tim.matthe...@gmail.com 2009-09-26 21:54:55 PDT ---
(In reply to comment #13)
 Dear Rainer,
 Your patch applied against dmd 1.047 fixes the issue with building both gtkD
 and QtD. It would be cool if it were included in the upstream.
 
 Thank you.

I had to use this to compile gtkD too and it worked well. The experimental dnet
compiler being based on dmd's front end also has this issue and the patch did
the job for that too.

Thanks Rainer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #13 from Eldar Insafutdinov e.insafutdi...@gmail.com 2009-09-19 
13:37:03 PDT ---
(In reply to comment #12)
 Created an attachment (id=454) [details]
 do all imports before semantic analysis
 
 Having done some investigation of the deferred semantic analysis mechanism, it
 might be best to try to keep its usage to a minimum, because it might have a
 negative impact on compilation speed and memory consumption. So my patch is
 probably not so bad after all.
 
 Some details: 
 The problem is that, though the files are parsed, their symbol table might not
 yet hold any identifiers, because the semantic analysis has not been run on 
 the
 module.
 
 So I introduced another compile step after parsing, but before the semantic
 analysis. The files on the command line are scanned for import statements,
 loading and parsing the referenced modules and applying the same process on
 these files. In the same step, the global members of the module are added to
 the modules' symbol table (this has been moved from the semantic analysis).
 
 The import statements must not be conditional, because the semantic analysis 
 is
 needed to evaluate a static if statement. If the semantic analysis gets to
 the import statement, the additional compile step kicks in again for any 
 module
 not already loaded.
 
 This patch also fixes bugs #3286, #1592 and #258

Dear Rainer,
Your patch applied against dmd 1.047 fixes the issue with building both gtkD
and QtD. It would be cool if it were included in the upstream.

Thank you.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #9 from Walter Bright bugzi...@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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Rainer Schuetze r.sagita...@gmx.de changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de


--- Comment #10 from Rainer Schuetze r.sagita...@gmx.de 2009-09-11 13:27:11 
PDT ---
It has shown up a number of times, for example in #258 and #1592.

I have a patch for this (and the bugs mentioned above) that parses every file
that is unconditionally imported before any semantic analysis.

As this introduces another compile step, I'm not sure if this is a good patch,
and it will fail for conditional imports. So I'm hoping for a more general
solution that works with the deferred semantic analysis and solves more of the
forward reference problems.

Should I attach the patch anyway?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Brad Roberts bra...@puremagic.com changed:

   What|Removed |Added

   Priority|P2  |P1
 CC||bra...@puremagic.com


--- Comment #7 from Brad Roberts bra...@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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #8 from Stewart Gordon s...@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\bugsdmd -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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

 CC||s...@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 s...@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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #4 from simon s.d.hamm...@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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #5 from simon s.d.hamm...@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: ---


[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

2009-09-05 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #6 from Stewart Gordon s...@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\bugsdmd -c wincom.d

C:\Users\Stewart\Documents\Programming\D\Tests\bugsdmd -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\bugsdmd -c wincom.d winapi.d

C:\Users\Stewart\Documents\Programming\D\Tests\bugsdmd -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: ---