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

fix array(String) to work with no autodecode #7133

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

WalterBright
Copy link
Member

With autodecode turned off, the return value wasn't a dchar[].

First fix for #7130

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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 "master + phobos#7133"

if (isNarrowString!String)
{
import std.utf : toUTF32;
auto temp = str.toUTF32;
/* Unsafe cast. Allowed because toUTF32 makes a new array
and copies all the elements.
*/
return () @trusted { return cast(ElementType!String[]) temp; } ();
return () @trusted { return cast(CopyTypeQualifiers!(ElementType!String, dchar)[]) temp; } ();
Copy link
Contributor

Choose a reason for hiding this comment

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

Make one of these auto. That is a horrible return type to spell out twice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gah I meant typeof(return)

@WalterBright WalterBright merged commit 2ae3bb1 into dlang:master Aug 15, 2019
@WalterBright WalterBright deleted the array-nad branch August 15, 2019 06:25
@WalterBright WalterBright added the no autodecode Make Phobos work without autodecoding label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge no autodecode Make Phobos work without autodecoding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants