Skip to content

More fix for Issue 8705 - std.conv.to bug, from documentation #844

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

Merged
merged 2 commits into from
Oct 7, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Oct 6, 2012

http://d.puremagic.com/issues/show_bug.cgi?id=8705

Mutable care is just necessary for value type, and doesn't need for key types.


@monarchdodra, how about this change?

MV2 mv2 = to!MV2(v1); //Value must be kept mutable for insertion
result[k2] = mv2;
// Cast values temporarily to Unqual!V2 to store them to result variable
result[to!K2(k1)] = cast(Unqual!V2) to!(V2)(v1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpitck: to!V2(v1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. WIll fix.

Mutable care is just necessary for value type, and doesn't need for key types.
@monarchdodra
Copy link
Collaborator

LGTM, but I think extra unit tests are too hard on the linker. I had the exact same problem, hence the commented tests in the code.

What is odd is that it works on my machine (2.060, x64 win). Work on yours? Must be some kind of regression.

@9rnsr
Copy link
Contributor Author

9rnsr commented Oct 6, 2012

Ouch, it is like this?
I also develop in Windows native machine (Windows7 64bit), so I didn't see the problem.

@monarchdodra
Copy link
Collaborator

Yeah, I think the best you can do is comment the tests, and file a bug report. I was planning to get around to it, but haven't done it yet.

@9rnsr
Copy link
Contributor Author

9rnsr commented Oct 6, 2012

OK. Now, auto tester results are all green.

MV2[MK2] result;

// While we are "building" the AA, we need to unqualify its values, and only re-qualify at the end
Unqual!V2[K2] result;
Copy link
Collaborator

Choose a reason for hiding this comment

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

More nitpick: Isn't that just Unqual!T

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is core part of the bug 8705.
If T is const(int[int]), Unqual!T returns const(int)[int]. This is correct Unqual behavior, but has no meaning here.
Instead, Unqual!V2[K2] constructs int[int], it has a mutable values, and as far as written in comment, it allows assign in whole building the result.

andralex added a commit that referenced this pull request Oct 7, 2012
More fix for Issue 8705 - std.conv.to bug, from documentation
@andralex andralex merged commit 0e22a37 into dlang:master Oct 7, 2012
@andralex
Copy link
Member

andralex commented Oct 7, 2012

merged 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
Development

Successfully merging this pull request may close these issues.

3 participants