Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fix Issue 19049 - object.hashOf - don't wrap a public function with an identical public function #2239

Merged
merged 1 commit into from Jul 3, 2018

Conversation

n8sh
Copy link
Member

@n8sh n8sh commented Jul 2, 2018

This is hashOf in object.d:

size_t hashOf(T)(auto ref T arg, size_t seed = 0)
{
    import core.internal.hash;
    return core.internal.hash.hashOf(arg, seed);
}

This serves no purpose because core.internal.hash.hashOf is public and also has an auto ref argument. So core.internal.hash.hashOf should either be publicly imported or exposed through an alias.

This issue has synergy with PR #2238.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @n8sh!

Bugzilla references

Auto-close Bugzilla Severity Description
19049 enhancement object.hashOf - don't wrap a public function with an identical public function

Testing this PR locally

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

dub fetch digger
dub run digger -- build "master + druntime#2239"

@dlang-bot dlang-bot added the Enhancement New functionality label Jul 2, 2018
size_t hashOf(T)(auto ref T arg, size_t seed = 0)
{
static import core.internal.hash;
return core.internal.hash.hashOf(arg, seed);
Copy link
Member

Choose a reason for hiding this comment

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

Do we even need a body if it's for ddoc only? An empty body should work too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should work.

Copy link
Member Author

Choose a reason for hiding this comment

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

When I replace it with size_t hashOf(T)(auto ref T arg, size_t seed = 0); I get an error:

../dmd/generated/osx/release/64/dmd -conf= -c -w -o- -Isrc -Iimport -version=CoreDdoc -Dfdoc/object.html project.ddoc  src/object.d
src/object.d(1605): Error: function object.hashOf!(void delegate()).hashOf is not nothrow
src/object.d(1603): Error: nothrow function object.TypeInfo_Delegate.getHash may throw

@dlang-bot dlang-bot merged commit 707d703 into dlang:master Jul 3, 2018
@JinShil
Copy link
Contributor

JinShil commented May 16, 2019

This PR may have caused a regression: https://issues.dlang.org/show_bug.cgi?id=19701

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New functionality
Projects
None yet
5 participants