-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3868 from 9rnsr/fix13281
Issue 13281 - Print type suffix of real/complex literals in pragma(msg) and error diagnostic
- Loading branch information
Showing
7 changed files
with
93 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// REQUIRED_ARGS: -o- | ||
// PERMUTE_ARGS: | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
123 | ||
123u | ||
123L | ||
123LU | ||
123.4 | ||
123.4F | ||
123.4L | ||
123.4i | ||
123.4Fi | ||
123.4Li | ||
(123.4+5.6i) | ||
(123.4F+5.6Fi) | ||
(123.4L+5.6Li) | ||
--- | ||
*/ | ||
pragma(msg, 123); | ||
pragma(msg, 123u); | ||
pragma(msg, 123L); | ||
pragma(msg, 123uL); | ||
pragma(msg, 123.4); | ||
pragma(msg, 123.4f); | ||
pragma(msg, 123.4L); | ||
pragma(msg, 123.4i); | ||
pragma(msg, 123.4fi); | ||
pragma(msg, 123.4Li); | ||
pragma(msg, 123.4 +5.6i); | ||
pragma(msg, 123.4f+5.6fi); | ||
pragma(msg, 123.4L+5.6Li); | ||
|
||
static assert((123 ).stringof == "123"); | ||
static assert((123u ).stringof == "123u"); | ||
static assert((123L ).stringof == "123L"); | ||
static assert((123uL).stringof == "123LU"); | ||
static assert((123.4 ).stringof == "123.4"); | ||
static assert((123.4f ).stringof == "123.4F"); | ||
static assert((123.4L ).stringof == "123.4L"); | ||
static assert((123.4i ).stringof == "123.4i"); | ||
static assert((123.4fi).stringof == "123.4Fi"); | ||
static assert((123.4Li).stringof == "123.4Li"); | ||
static assert((123.4 +5.6i ).stringof == "123.4 + 5.6i"); | ||
static assert((123.4f+5.6fi).stringof == "123.4F + 5.6Fi"); | ||
static assert((123.4L+5.6Li).stringof == "123.4L + 5.6Li"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag13281.d(20): Error: cannot implicitly convert expression (123) of type int to string | ||
fail_compilation/diag13281.d(21): Error: cannot implicitly convert expression (123u) of type uint to string | ||
fail_compilation/diag13281.d(22): Error: cannot implicitly convert expression (123L) of type long to string | ||
fail_compilation/diag13281.d(23): Error: cannot implicitly convert expression (123LU) of type ulong to string | ||
fail_compilation/diag13281.d(24): Error: cannot implicitly convert expression (123.4) of type double to int | ||
fail_compilation/diag13281.d(25): Error: cannot implicitly convert expression (123.4F) of type float to int | ||
fail_compilation/diag13281.d(26): Error: cannot implicitly convert expression (123.4L) of type real to int | ||
fail_compilation/diag13281.d(27): Error: cannot implicitly convert expression (123.4i) of type idouble to int | ||
fail_compilation/diag13281.d(28): Error: cannot implicitly convert expression (123.4Fi) of type ifloat to int | ||
fail_compilation/diag13281.d(29): Error: cannot implicitly convert expression (123.4Li) of type ireal to int | ||
fail_compilation/diag13281.d(30): Error: cannot implicitly convert expression ((123.4+5.6i)) of type cdouble to int | ||
fail_compilation/diag13281.d(31): Error: cannot implicitly convert expression ((123.4F+5.6Fi)) of type cfloat to int | ||
fail_compilation/diag13281.d(32): Error: cannot implicitly convert expression ((123.4L+5.6Li)) of type creal to int | ||
--- | ||
*/ | ||
|
||
string x1 = 123; | ||
string x2 = 123u; | ||
string x3 = 123L; | ||
string x4 = 123uL; | ||
int y1 = 123.4; | ||
int y2 = 123.4f; | ||
int y3 = 123.4L; | ||
int y4 = 123.4i; | ||
int y5 = 123.4fi; | ||
int y6 = 123.4Li; | ||
int y7 = 123.4 +5.6i; | ||
int y8 = 123.4f+5.6fi; | ||
int y9 = 123.4L+5.6Li; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters