Bug 258 – Undefined identifier error for circular import

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-07-19T16:53:00Z
Last change time
2014-02-15T13:18:56Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
smjg

Comments

Comment #0 by smjg — 2006-07-19T16:53:07Z
----- core.d ----- public import application, windowbase; ----- application.d ----- import core; WindowBase mainWindow() { return null; } ----- windowbase.d ----- import core; class WindowBase {} ---------- D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c core.d application.d(3): identifier 'WindowBase' is not defined application.d(3): WindowBase is used as a type D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c windowbase.d application.d(3): identifier 'WindowBase' is not defined application.d(3): WindowBase is used as a type D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c application.d ---------- It doesn't matter whether the imports in application.d and windowbase.d are private or public. If the imports in core.d are swapped, all files compile without error.
Comment #1 by thomas-dloop — 2006-09-14T07:15:37Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-07-19: > http://d.puremagic.com/issues/show_bug.cgi?id=258 > ----- core.d ----- > public import application, windowbase; > ----- application.d ----- > import core; > > WindowBase mainWindow() { > return null; > } > ----- windowbase.d ----- > import core; > > class WindowBase {} > ---------- > D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c core.d > application.d(3): identifier 'WindowBase' is not defined > application.d(3): WindowBase is used as a type > > D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c windowbase.d > application.d(3): identifier 'WindowBase' is not defined > application.d(3): WindowBase is used as a type > > D:\My Documents\Programming\D\smjg\libs\sdwf bug>dmd -c application.d > ---------- > > It doesn't matter whether the imports in application.d and windowbase.d are > private or public. If the imports in core.d are swapped, all files compile > without error. Added to DStress as http://dstress.kuehne.cn/compile/i/import_17_A.d http://dstress.kuehne.cn/compile/i/import_17_B.d http://dstress.kuehne.cn/compile/i/import_17_C.d http://dstress.kuehne.cn/compile/i/import_17_D.d http://dstress.kuehne.cn/compile/i/import_17_E.d http://dstress.kuehne.cn/compile/i/import_17_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFCU1WLK5blCcjpWoRAhiWAJ9Q5A8u4BY03DDFEtStywdz0tgkHQCdHKaT ONZSp+czsmiAQYtOdUqcEs0= =wRYq -----END PGP SIGNATURE-----
Comment #2 by r.sagitario — 2009-09-18T00:43:41Z
The patch for issue 3301 also fixes this issue.
Comment #3 by bugzilla — 2009-10-13T13:43:27Z
Fixed dmd 1.049 and 2.034