Skip to content

fix issue 7804 - Allow __traits(getMember) as a BasicType#8938

Merged
thewilsonator merged 1 commit intomasterfrom
unknown repository
Nov 11, 2018
Merged

fix issue 7804 - Allow __traits(getMember) as a BasicType#8938
thewilsonator merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Nov 10, 2018

This the continuation of #8031.

@ghost ghost requested review from RazvanN7 and WalterBright as code owners November 10, 2018 17:56
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @bbasile! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
7804 enhancement Cannot alias __traits directly

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

@thewilsonator
Copy link
Contributor

Dscanner dmd/mtype.d(5046:25)[warn]: Useless final attribute, functions declared within a final class are never virtual

@thewilsonator thewilsonator merged commit 0427b57 into dlang:master Nov 11, 2018
@ghost
Copy link
Author

ghost commented Nov 11, 2018

I'm afraid that this one has been merged a bit too eagerly so you can still review and will push additional correction if needed. For example i just addressed one of the problem pointed out in the old PR just a few hours ago (statement VS declaration).

@thewilsonator
Copy link
Contributor

Oops sorry.

@ghost
Copy link
Author

ghost commented Nov 11, 2018

In theory i think that you should have used the auto-merge label to trigger the bot. Then it wouldn't have worked without the approval of a code owner (reviewers with the locker symbol at the top right corner).

@thewilsonator
Copy link
Contributor

thewilsonator commented Nov 11, 2018

mir-algothithm is currently broken though, is build kite is red. auto-merge wouldn't do anything for a long time.

@Geod24
Copy link
Member

Geod24 commented Nov 11, 2018

Yeah that one definitely needed more review. I for one have comments about the changelog wording and some tests to be added with regards to other traits that the one intended to work.

I understand the desire to be quick but there needs to be a minimal period to allow people to review things, according to the importance of the PR.

@thewilsonator
Copy link
Contributor

Oh for some reason I though the one it was replacing was approved, it wasn't. I've been looking at too many PRs, need to take a break.

@ghost
Copy link
Author

ghost commented Nov 11, 2018

@Geod24, can you make suggestions for the changelog entry ?

About the other traits, getMember is checked during parsing. Later what happens during semantic is then that possible getMember errors are not specific to the language enhancement, but are normal traits errors, alias errors or type errors.

I can however add these errors (with the changelog modification PR):

module more;

__traits(getMember, more, "object") not_a_Type; // the trait suceeds but the variable decl not
__traits(getMember, more, "NotExisting") not_existing; // trait error
alias nothing = __traits(getMember, more, "NotExisting"); // trait error          

@Geod24
Copy link
Member

Geod24 commented Nov 11, 2018

Okay, so my first test (with master, 0427b57) was:

class Foo
{
    void func() {}
}

void main ()
{
    __traits(getMember, Foo, "func") var;
}
% ./generated/osx/release/64/dmd foo.d
[3]    81445 segmentation fault  ./generated/osx/release/64/dmd foo.d

@ghost ghost deleted the alias-equal-traits branch November 21, 2018 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants