Skip to content

Comments

[dmd-cxx] fix Issue 19912: No implicit import of object module when an object declaration exists.#9999

Merged
ibuclaw merged 1 commit intodlang:dmd-cxxfrom
ibuclaw:dmd-cxx-19912
Jun 9, 2019
Merged

[dmd-cxx] fix Issue 19912: No implicit import of object module when an object declaration exists.#9999
ibuclaw merged 1 commit intodlang:dmd-cxxfrom
ibuclaw:dmd-cxx-19912

Conversation

@ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 8, 2019

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Auto-close Bugzilla Severity Description
19912 critical [module] No implicit import of object module when an object declaration exists.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "dmd-cxx + dmd#9999"

@ibuclaw ibuclaw changed the title fix Issue 19912: No implicit import of object module when an object declaration exists. [dmd-cxx] fix Issue 19912: No implicit import of object module when an object declaration exists. Jun 8, 2019
@JinShil
Copy link
Contributor

JinShil commented Jun 9, 2019

Are you all sure about this? It seems that, instead, any object declaration would generate an error just like it does for TypeInfo See https://run.dlang.io/is/1mwpVi Don't get me wrong, I don't like the fact that these runtime objects must be declared in object.d, but it seems to be a more systemic issue than just the symbol object.

I'd prefer that object.d were not automatically imported at all, but I tried that, and was overruled.

Another option I'm considering is renaming object.d to package.d and have the compiler automatically import the runtime "package" instead of a specific module.

Can't we just have dmd.conf declare the automatic import of object.d or something so it's not hard-coded into the compiler like it currently is?

Anyway, can we discuss how to move forward on this? I think there's more to consider here than just what this PR addresses.

@thewilsonator
Copy link
Contributor

I'd prefer that object.d were not automatically imported at all, but I tried that, and was overruled.

I think a better idea would be to have an auto imported package that would by default import object, that way we could split up the Frankenstein that is object.d. Then you could easily remove stuff that you don't want, since if you are going to the effort of not wanting classes deleting a file from the runtime that you are using is a lot easier than ripping out bits of object.d.

@JinShil
Copy link
Contributor

JinShil commented Jun 9, 2019

It seems that, instead, any object declaration would generate an error just like it does for TypeInfo See https://run.dlang.io/is/1mwpVi

Oops, sorry. I see now that this PR is actually adding that behavior. That is consistent with the status quo, so 👍

I think this PR is OK as is, as it maintains the status quo, but there's still a systemic problem with the way D automatically imports the runtime and the fact that it requires certain symbols to be declared in a specific place. But, that's something that can be addressed later, I suppose.

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 9, 2019

Yes, this just makes it so that you can't override the automatic import with another declaration of the same name.

@ibuclaw ibuclaw merged commit 78dc311 into dlang:dmd-cxx Jun 9, 2019
@ibuclaw ibuclaw deleted the dmd-cxx-19912 branch June 9, 2019 05:37
/*
TEST_OUTPUT:
---
fail_compilation/fail19912b.d(8): Error: class `fail19912b.object` conflicts with import `fail19912b.object` at fail_compilation/fail19912b.d
Copy link
Contributor

@jacob-carlborg jacob-carlborg Jun 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message mentions import, but there is no import in the source code. Can we come up with a better message?

kraj pushed a commit to kraj/gcc that referenced this pull request Jun 16, 2019
d/dmd: Merge upstream dmd 78dc31152

Fixes bug where the object module was not always implicitly imported.

Reviewed-on: dlang/dmd#9999

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272340 138bc75d-0d04-0410-961f-82ee72b054a4
asiekierka pushed a commit to WonderfulToolchain/gcc that referenced this pull request May 16, 2022
	PR d/90651
d/dmd: Merge upstream dmd 78dc31152

Fixes bug where the object module was not always implicitly imported.

Reviewed-on: dlang/dmd#9999

From-SVN: r272340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants