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
Turn informational messages of transition=complex into deprecated #7081
Conversation
Thanks for your pull request, @ibuclaw! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
I don't think people will use this flag, so what stops us from turning it into a deprecation message for everyone? |
And identifying and removing (or fixing) all uses of complex or imaginary types in druntime and phobos. |
src/ddmd/mtype.d
Outdated
t = (cast(TypeEnum)t).sym.memtype; | ||
|
||
// Type is forward referenced or not a scalar type. | ||
if (t is null || !t.isTypeBasic()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the check for typebasic really necessary? This should be covered by line 3076. Also, the null check seems unnecessary. Is there a test case for this? According to the previous logic, it could only be null if memtype
is null. Can this ever happen?
src/ddmd/mtype.d
Outdated
@@ -3091,11 +3098,13 @@ extern (C++) abstract class Type : RootObject | |||
} | |||
if (t.iscomplex()) | |||
{ | |||
fprintf(global.stdmsg, "%s: use of complex type '%s' is scheduled for deprecation, use 'std.complex.Complex!(%s)' instead\n", p ? p : "", toChars(), rt.toChars()); | |||
deprecation(loc, "use of complex type `%s` is scheduled for deprecation, use `std.complex.Complex!(%s)` instead\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's clearly not scheduled
for deprecated, it is deprecated, as it calls deprecation()
@@ -134,3 +134,10 @@ creal test14488b() | |||
return 1 + 0i; | |||
} | |||
|
|||
// Forward referenced types shouldn't cause spurious errors during test for complex or imaginary. | |||
enum E; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the test case for the null
t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the error is in getMemType if I recall correctly.
@@ -134,3 +134,10 @@ creal test14488b() | |||
return 1 + 0i; | |||
} | |||
|
|||
// Forward referenced types shouldn't cause spurious errors during test for complex or imaginary. | |||
enum E; | |||
struct S; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this case is strictly necessary, but no problem leaving it in.
8de6634
to
d308be3
Compare
Should rebase. |
Rebased. There's an old open PR in #5731 that I should look at for comparison to this. |
e1f5808
to
1dd4787
Compare
Why not make it a deprecation instead (without the switch) ? |
@mathias-lang-sociomantic I found a small bug when building phobos with it turned on. So I'm not sure if people were using it. I think it would be better to first push deprecations in phobos, and the compiler/druntime interface updated. Then turn on deprecation by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. What's blocking this?
FWIW I agree that the deprecation messages should be turned on by default as no one will be using this switch, but this can always be done in a separate PR ...
@ibuclaw I'm itching to pull this. Is it ready to go? Is there anything outstanding? |
Probably should wait until turning deprecations on by default. |
src/ddmd/mtype.d
Outdated
t = (cast(TypeEnum)t).sym.memtype; | ||
|
||
// Type is forward referenced. | ||
if (t is null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enums are setup to be lazily analyzed, meaning if it is fwd referenced just run semantic() on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should probably be anonymous enum. The ICE here was because an enum was declared but never defined. See test.
@ibuclaw If this is ready to go, please rebase and I'll merge. |
There's no merge conflicts, why rebase? I'll update the comment to clarify why there is a null check for enums. @WalterBright are you blocking this? |
Ah, now the page is telling me that there are conflicts, and dlang bot has added a tag. |
The GitHub web interface seems to think there is a conflict for Either that or this is one of those old PRs that has reached GitHubs 1000 status limit and is no longer updated. In that case, a force push should reset it. |
@ibuclaw Sorry, but can you please rebase again? This is why we need to act swiftly on PRs that are ready to go. If you want to wait for @WalterBright to sign off on this first, please explicitly say so or mark it as "Needs Approval", otherwise, I'll merge right after you rebase. |
@JinShil - rebased. If you think that all concerns have been addressed sufficiently, then go ahead and merge. |
I think it's high time to push forward with this.
Also ironed out a small problem I found when building phobos with this turned on.
https://issues.dlang.org/show_bug.cgi?id=14488