Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REG2.068.1-b2] Issue 15017 - assigning a Variant to be value in a hashmap #5042

Merged
merged 1 commit into from Sep 6, 2015

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Sep 6, 2015

https://issues.dlang.org/show_bug.cgi?id=15017

Request TypeInfo generation where the corresponding glue layer code needs it.

@@ -9571,7 +9573,10 @@ Expression *DeleteExp::semantic(Scope *sc)
FuncDeclaration *fd = sd->dtor;

if (!f)
{
semanticTypeInfo(sc, ts);
Copy link
Member

Choose a reason for hiding this comment

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

These implicit dependencies are really the worst maintenance wise?
Is there any way we can do this in the glue code where the TypeInfo is actually requested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately it's impossible. Currently a struct TypeInfo may refer to template member functions (opEquals and opCmp), and their mangled name is affected by the attribute inference result. So we should guarantee to run those semantic3 pass before the reach to glue layer. That's why the semanticTypeInfo call is necessary in each places.

Copy link
Member

Choose a reason for hiding this comment

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

I think the compiler needs a larger refactoring: the transformations/lowerings made in the glue layer must happen while semantic analysis is still possible. That would obsolete all this guessing what typeinfo will be needed during code generation, sometimes translated to something else making the typeinfo unnecessary. Without that change templated library implementation of associative and dynamic arrays are unlikely to produce good inlining results.

My current idea regarding such a refactoring would be to do the lowerings in a "semantic4" step, that starts once semantic3 is complete, but can still go back to the earlier stages. That way, user code will produce error messages as now, but low-level library code might show the internal names instead.

Copy link
Member

Choose a reason for hiding this comment

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

We already do lower things like to reach in earlier semantic steps so it should be possible for other constructs as well.

MartinNowak added a commit that referenced this pull request Sep 6, 2015
[REG2.068.1-b2] Issue 15017 - assigning a Variant to be value in a hashmap
@MartinNowak MartinNowak merged commit c9c12bf into dlang:stable Sep 6, 2015
@9rnsr 9rnsr deleted the fix15017 branch September 6, 2015 11:49
@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 6, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants