Skip to content

fix issue 19708 - Can't use __traits(getAttributes, ...)[...] as a type#10144

Merged
dlang-bot merged 1 commit intostablefrom
unknown repository
Jul 6, 2019
Merged

fix issue 19708 - Can't use __traits(getAttributes, ...)[...] as a type#10144
dlang-bot merged 1 commit intostablefrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Jul 6, 2019

The first part of the fix is simply to extract Types from TypeExprs when a TypeTrait returning a TypeTuple contained some .

The second part is more delicate. A flag used by the TypeTraits was not set correctly because the TypeTrait was not directly aliased but wrapper in a TypeNext. To fix te problem the type next is replaced by its content after aliasing it. It's fixed by refactoring a bit the feature using a new SCOPE member.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Basile-z! 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 coverage diff by visiting the details link of the codecov check)
  • 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
19708 normal Can't use __traits(getAttributes, ...)[...] as a type

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

@ghost
Copy link
Author

ghost commented Jul 6, 2019

Don't auto-merge for now because I may try something with Scope.flags to replace TypeTraits.inAliasDeclaration.

@ghost ghost requested review from Geod24 and ibuclaw as code owners July 6, 2019 13:17
@ghost
Copy link
Author

ghost commented Jul 6, 2019

Yeah it really looks like using the scope flags fixes a flaw in the original design. There nothing really special anymore in aliasSemantic now. 🎉

@MoonlightSentinel
Copy link
Contributor

MoonlightSentinel commented Jul 6, 2019

@Basile-z Thank you for picking this up.

Once this fix is released the workaround should be removed from the spec
(https://dlang.org/spec/attribute.html#uda)

@thewilsonator
Copy link
Contributor

So, it this good to go?

@ghost
Copy link
Author

ghost commented Jul 6, 2019

Once this fix is released the workaround should be removed from the spec

Yes I see that point 4 still uses a Tuple.

So, it this good to go?

Yes.

@dlang-bot dlang-bot merged commit aa2d70b into dlang:stable Jul 6, 2019
@ghost ghost deleted the issue-19708-alt branch July 6, 2019 14:39
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