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

Turn informational messages of transition=complex into deprecated #7081

Merged
merged 1 commit into from Jan 6, 2018

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Aug 13, 2017

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

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

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.

@wilzbach
Copy link
Member

I don't think people will use this flag, so what stops us from turning it into a deprecation message for everyone?

@ibuclaw
Copy link
Member Author

ibuclaw commented Aug 13, 2017

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())
Copy link
Member

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",
Copy link
Member

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;
Copy link
Member

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?

Copy link
Member Author

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;
Copy link
Member

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.

@ibuclaw
Copy link
Member Author

ibuclaw commented Aug 28, 2017

Should rebase.

@ibuclaw
Copy link
Member Author

ibuclaw commented Sep 28, 2017

Rebased. There's an old open PR in #5731 that I should look at for comparison to this.

@ibuclaw ibuclaw force-pushed the depcomplex branch 2 times, most recently from e1f5808 to 1dd4787 Compare September 28, 2017 21:29
@mathias-lang-sociomantic
Copy link
Contributor

Why not make it a deprecation instead (without the switch) ?
This switch has been there for a while, people interested in it have plenty of DMD releases to use to fix it.

@ibuclaw
Copy link
Member Author

ibuclaw commented Oct 6, 2017

@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.

Copy link
Member

@wilzbach wilzbach left a 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 ...

@JinShil
Copy link
Contributor

JinShil commented Dec 27, 2017

@ibuclaw I'm itching to pull this. Is it ready to go? Is there anything outstanding?

@JinShil
Copy link
Contributor

JinShil commented Dec 27, 2017

We also need an update to the deprecations table, but I don't want it to hold up this PR.

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)
Copy link
Member

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.

Copy link
Member Author

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.

@JinShil
Copy link
Contributor

JinShil commented Jan 4, 2018

@ibuclaw If this is ready to go, please rebase and I'll merge.

@ibuclaw
Copy link
Member Author

ibuclaw commented Jan 5, 2018

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?

@ibuclaw
Copy link
Member Author

ibuclaw commented Jan 5, 2018

Ah, now the page is telling me that there are conflicts, and dlang bot has added a tag.

@JinShil
Copy link
Contributor

JinShil commented Jan 5, 2018

There's no merge conflicts, why rebase?

The GitHub web interface seems to think there is a conflict for src/ddmd/mars.d and src/ddmd/mtype.d I think because of the transition from ddmd to dmd.

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.

@JinShil
Copy link
Contributor

JinShil commented Jan 6, 2018

@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.

@ibuclaw
Copy link
Member Author

ibuclaw commented Jan 6, 2018

@JinShil - rebased. If you think that all concerns have been addressed sufficiently, then go ahead and merge.

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