282 – Bizarre circular import nested name invisibility issue

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 282 - Bizarre circular import nested name invisibility issue
Summary: Bizarre circular import nested name invisibility issue
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2006年08月10日 22:43 UTC by Jarrett Billingsley
Modified: 2014年02月15日 13:19 UTC (History)
4 users (show)

See Also:


Attachments
ensure semantic run when searching struct for members (1.12 KB, patch)
2009年09月18日 00:56 UTC, Rainer Schuetze
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Jarrett Billingsley 2006年08月10日 22:43:12 UTC
I really don't know what else to call this, and it's a bit tedious to get to happen. So here's the general idea:
------ [modules/test1.d] --------
module modules.test1;
import modules.test2;
struct A
{
	enum B
	{
		One,
		Two
	}
}
void bar()
{
	foo();
}
--------- [modules/test2.d] ---------
module modules.test2;
import modules.test1;
A.B foobar; // error, no property B for type A?!
void foo()
{
	int x;
	if(x == A.B.One) // but this is OK
		x = 1;
}
---------------------------------
Some interesting facts:
- This only seems to happen if the modules are in a package. If they're two top-level modules, it works fine.
- Notice I can't use A.B as a type, but I can in fact access A.B's members.
- Using static imports/aliased imports does not help.
I don't know how to get it to not work the way it does in MiniD - that is, I can't even use A.B in the same module that A.B is defined!
This is, for me, something of a showstopper.. I'll probably be using 0.162 for a bit, which is sad, considering how cool the 0.163 features are! I don't know if I should change the priority of this bug, but this is something that can't be worked around easily, so I'd put it pretty high up there.
Comment 1 Dawid Ciężarkiewicz 2006年08月11日 07:32:12 UTC
Related to #204. Maybe even same problem.
Comment 2 Dawid Ciężarkiewicz 2006年08月11日 07:33:27 UTC
(In reply to comment #1)
> Related to #204. Maybe even same problem.
> 
Err. #102 . Sorry.
Comment 3 Rainer Schuetze 2009年09月18日 00:56:35 UTC
Created attachment 455 [details] 
ensure semantic run when searching struct for members
When searching members of a class that is not yet semantically analyzed, the analysis is run on it. This is not done for structs or unions, which is probably an omission.
Comment 4 Walter Bright 2009年12月29日 03:07:49 UTC
Changeset 318
Comment 5 Leandro Lucarella 2009年12月29日 09:02:30 UTC
http://d.puremagic.com/issues/show_bug.cgi?id=282 
Comment 7 Walter Bright 2009年12月31日 11:09:22 UTC
Fixed dmd 1.054 and 2.038


AltStyle によって変換されたページ (->オリジナル) /