D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21330 - __traits(getUnitTests) should include unittests from anonymous mixins
Summary: __traits(getUnitTests) should include unittests from anonymous mixins
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-10-19 17:15 UTC by Max Samukha
Modified: 2020-11-16 00:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2020-10-19 17:15:44 UTC
mixin template Test() {
    unittest {
    }
    
    void foo() {
    }
}
mixin Test;

pragma(msg, __traits(allMembers, onlineapp)); // tuple("object", "Test", "foo", "main")
pragma(msg, __traits(getUnitTests, onlineapp)); // tuple()
    
void main() {
}

If allMembers returns "foo", then it is reasonable to expect that getUnitTests should return the unittest. Actually, it it impossible to get to the unittest at all because it is impossible to refer to anonymous mixins explicitly.
Comment 1 Dlang Bot 2020-10-19 22:52:20 UTC
@BorisCarvajal created dlang/dmd pull request #11888 "Fix Issue 21330 - __traits(getUnitTests) should include unittests fro…" fixing this issue:

- Fix Issue 21330 - __traits(getUnitTests) should include unittests from anonymous mixins

https://github.com/dlang/dmd/pull/11888
Comment 2 Dlang Bot 2020-10-19 23:33:42 UTC
dlang/dmd pull request #11888 "Fix Issue 21330 - __traits(getUnitTests) should include unittests fro…" was merged into stable:

- 0c7ee93587ad75793c7fa67ac896cb6b9180d6f2 by Boris Carvajal:
  Fix Issue 21330 - __traits(getUnitTests) should include unittests from anonymous mixins

https://github.com/dlang/dmd/pull/11888
Comment 3 Dlang Bot 2020-11-16 00:10:11 UTC
dlang/dmd pull request #11961 "merge stable" was merged into master:

- 738ea653d94c17a534aa9350fdbdb377befa41d2 by Boris Carvajal:
  Fix Issue 21330 - __traits(getUnitTests) should include unittests from anonymous mixins

https://github.com/dlang/dmd/pull/11961