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 Issue 21916 - Error message is obfuscated when using wrong format… #8070

Merged
merged 1 commit into from May 13, 2021

Conversation

CyberShadow
Copy link
Member

… specifier at compile-time

Before:

.../std/format/package.d(748): Error: expression `FormatException(['I', 'n', 'c', 'o', 'r', 'r', 'e', 'c', 't', ' ', 'f', 'o', 'r', 'm', 'a', 't', ' ', 's', 'p', 'e', 'c', 'i', 'f', 'i', 'e', 'r', ' ', 'f', 'o', 'r', ' ', 'r', 'a', 'n', 'g', 'e', ':', ' ', '%', 'f'], ".../std/format/internal/write.d", 1722LU, null, null, 0u)` is not constant
.../std/format/package.d(1370):        while evaluating: `static assert(!e)`
test.d(5): Error: template instance `std.format.format!("%f", int[])` error instantiating

After:

.../std/format/package.d(1370): Error: static assert:  "Incorrect format specifier for range: %f"
test.d(5):        instantiated from here: `format!("%f", int[])`

No test because (AFAIK) we can't test static assert error messages in Phobos.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @CyberShadow!

Bugzilla references

Auto-close Bugzilla Severity Description
21916 minor Error message is obfuscated when using wrong format specifier at compile-time

Testing this PR locally

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

dub run digger -- build "master + phobos#8070"

@dlang-bot dlang-bot merged commit 28b9d08 into dlang:master May 13, 2021
@berni44
Copy link
Contributor

berni44 commented May 13, 2021

This also fixed issue 21774. :-)

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