[dmd-internals] Regression introduced by the fix for bug 314.

Leandro Lucarella luca at llucax.com.ar
Thu Jan 19 03:27:38 PST 2012


Speaking of regressions :)

I will report this here for 2 reasons:
1) I don't know if bugs found in an unrelease version should be added to
   bugzilla (I think they should, but I don't know the current policy).
2) I'm not sure the regression is a bug or a feature.

This is how to reproduce the regression:

	echo 'module m1; struct S {}' > m1.d
	echo 'module m2; struct S {}' > m2.d
	echo 'module m3; import m1; import S = m2; S.S s;' > m3.d
	dmd -c m3.d

This works without the fix, but with the fix I get this errors:

	m3.d(1): Error: m1.S at m1.d(1) conflicts with m2 at m3.d(1)
	m3.d(1): Error: no property 'S' for type 'S'
	m3.d(1): Error: S.S is used as a type
	m3.d(1): Error: variable m3.s voids have no value

The only important is the first one. If you change m3 like this it works again:

	echo 'module m3; import m1; import X = m2; alias X S; S.S s;' > m3.d
	                                   ^       ^^^^^^^^^

I talked to Christian Kamm and he said this was somehow intentional,
that a selective import shouldn't hide a previously defined symbol.
I think it should be the same as using an alias, it's explicit enough to
be sure I really want to use the specified symbol instead of any other
else.

I can't find anything so specific in the specs though, so I would like
to know if there is already a well defined position about this and in
the case that's not well specified, the specs should be improved to be
more clear.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Mi mami llevo a tu papi con el fuquete! Menéalo! Mi mami llevo a tu
papi con el fuquete!
	-- Sidharta Kiwi


More information about the dmd-internals mailing list