Skip to content

fix Issue 17425 - add __traits(getParameterStorageClasses, f, i)#6829

Merged
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:fix17425
May 26, 2017
Merged

fix Issue 17425 - add __traits(getParameterStorageClasses, f, i)#6829
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:fix17425

Conversation

@WalterBright
Copy link
Member

The point of this is so that std.traits.ParameterStorageClassTuple() can be implemented without needing to study the name mangling.

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
17425 add __traits(getParameterStorageClasses, f, i)

@WalterBright
Copy link
Member Author

Blocking dlang/phobos#5427

@WalterBright WalterBright added the Review:Blocking Other Work review and pulling should be a priority label May 26, 2017
@UplinkCoder
Copy link
Member

@WalterBright there is some kind of error on osx32
I am not sure if it is related.

@WalterBright
Copy link
Member Author

I am not sure if it is related.

Apparently another heisenbug in the testing scripts.

Copy link
Member

@UplinkCoder UplinkCoder left a comment

Choose a reason for hiding this comment

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

Looks fine to me.

Copy link
Member

@rainers rainers left a comment

Choose a reason for hiding this comment

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

Just a few nits, otherwise LGTM.

@@ -0,0 +1,18 @@
add __traits(getParameterStorageClasses, f, i)

$(LINK2 https://issues.dlang.org/show_bug.cgi?id=17425, Bugzilla 17425)
Copy link
Member

Choose a reason for hiding this comment

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

The changelog entry seems a bit terse. I'd use at least more descriptive variable names. Also, linking to the documentation instead of bugzilla might be more helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI the auto-tester allows to preview this since some time (though I am not sure why this isn't part of the diff, CC @CyberShadow)
In any case the link is e.g. http://dtest.dlang.io/artifact/website-72ba79b73f635fb08bdfe69d6826833c1c4c2ee0-a9052bf749bf29e4ae70eb23d51613de/web/changelog/2.075.0_pre.html#changelog17425 (the _pre file in the changelog folder).
FWIW there also seems to be a parenthesis problem in another changelog file..

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't link to the documentation because that PR has not been pulled.

}
if (e.ident == Id.getParameterStorageClasses)
{
/* Accept a function symbol or a type, followed by a parameter index.
Copy link
Member

Choose a reason for hiding this comment

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

How about putting this code into a function? This improves readable and avoids making this function even larger (dmd is rather slow optimizing large functions).

Copy link
Member Author

Choose a reason for hiding this comment

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

I leave refactorings to subsequent PRs, because they distract from what is being changed here.

return new ErrorExp();
}
ex = ex.ctfeInterpret();
auto ii = ex.toUInteger();
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't propagate errors if the expression does not evaluate to an integer. That is not checked in other uses of toInteger/toUInteger elsewhere, too, though. Maybe add test pragma(msg, __traits(getParameterStorageClasses, foo, "1"));?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a generic problem with all those functions, and fixing them should be in a separate PR.

@WalterBright WalterBright merged commit f9db662 into dlang:master May 26, 2017
@WalterBright WalterBright deleted the fix17425 branch May 26, 2017 22:32
@CyberShadow
Copy link
Member

though I am not sure why this isn't part of the diff, CC @CyberShadow

Oops, diff was eaten by an overly voracious disk cleanup script. Fixed for future cleanups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review:Blocking Other Work review and pulling should be a priority Severity:Bug Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants