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 18251 - deprecate + transition=complex shouldn't look at functions with non-matching if constraints #12435

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Apr 15, 2021

One workaround for the issue was to put deprecated templates into a code block.

deprecated
{
    auto issue18251(T)(T t)
    if (__traits(isDeprecated, T))
    {
        return T.init;
    }
}

This patch makes it so that the test for issue 18251 has no difference to the above at an AST level.

@ibuclaw ibuclaw added the Review:Blocking Other Work review and pulling should be a priority label Apr 15, 2021
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Auto-close Bugzilla Severity Description
18251 normal deprecate + transition=complex shouldn't look at functions with non-matching if constraints

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 + dmd#12435"

compilable/diag20916.d(32): Deprecation: function `diag20916.Bar.toString!().toString` is deprecated
compilable/diag20916.d(32): Deprecation: template `diag20916.Bar.toString()()` is deprecated
Copy link
Member Author

Choose a reason for hiding this comment

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

This function is declared as:

 deprecated string toString()() const { return "42"; }

If you were to change it to...

 deprecated { string toString()() const { return "42"; } }

You'd instead get a deprecation on the template.

So this new diagnostic is correct, as both deprecated template and deprecated { template } now give the same deprecation warning.

@ibuclaw
Copy link
Member Author

ibuclaw commented Apr 15, 2021

Bleh, I'll split this up into three, as it covers a few possibly sensitive areas.

@@ -2,8 +2,6 @@
TEST_OUTPUT
---
fail_compilation/fail21830.d(24): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type
fail_compilation/fail21830.d(8): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type
fail_compilation/fail21830.d(24): instantiated from here: `test21830!(OldS21830)`
Copy link
Member Author

Choose a reason for hiding this comment

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

This removal is in-fact related to #12440, no idea how it got auto-merged...

@ibuclaw
Copy link
Member Author

ibuclaw commented Apr 16, 2021

@thewilsonator unblocked and ready.

@dlang-bot dlang-bot merged commit d336edd into dlang:master Apr 16, 2021
@ibuclaw ibuclaw deleted the issue18251 branch April 16, 2021 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants