Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 22871 - Support aliases to __traits(parameters) #13804

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

MoonlightSentinel
Copy link
Contributor

@MoonlightSentinel MoonlightSentinel commented Mar 11, 2022

The current implementation had two bugs preventing users from using
the tuple returned by __traits(parameters) bound to an alias:

  • the parser rejected typeof(__traits(X)), i.e. a traits without
    parameters. Fixed by removing the check for existing arguments.
  • type semantic rejected the alias as invalid and eagerly issued an
    error. Fixed by extending the list of viable traits.

@dlang-bot
Copy link
Contributor

dlang-bot commented Mar 11, 2022

Thanks for your pull request and interest in making D better, @MoonlightSentinel! 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
22871 critical Using an alias to `__traits(parameters)` causes unknown error

Testing this PR locally

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

dub run digger -- build "stable + dmd#13804"

@MoonlightSentinel MoonlightSentinel changed the title alias parameters Fix 22871 - Support aliases to __traits(parameters) Mar 11, 2022
@MoonlightSentinel MoonlightSentinel changed the base branch from master to stable March 11, 2022 14:35
@maxhaton maxhaton self-assigned this Mar 12, 2022
@maxhaton
Copy link
Member

@MoonlightSentinel ping me when this is ready for review

@MoonlightSentinel
Copy link
Contributor Author

@maxhaton the ifx in the second commit is ready for review. Currently marked as a draft because it includes #22868

@MoonlightSentinel MoonlightSentinel marked this pull request as ready for review March 12, 2022 17:20
The current implementation had two bugs preventing users from using
the tuple returned by `__traits(parameters)` bound to an alias:

- the parser rejected `typeof(__traits(X))`, i.e. a traits without
  parameters. Fixed by removing the check for existing arguments.
- type semantic rejected the alias as invalid and eagerly issued an
  error. Fixed by extending the list of viable traits.
@RazvanN7 RazvanN7 merged commit cc3c1de into dlang:stable Mar 14, 2022
dkorpel pushed a commit to dkorpel/dmd that referenced this pull request Mar 18, 2022
The current implementation had two bugs preventing users from using
the tuple returned by `__traits(parameters)` bound to an alias:

- the parser rejected `typeof(__traits(X))`, i.e. a traits without
  parameters. Fixed by removing the check for existing arguments.
- type semantic rejected the alias as invalid and eagerly issued an
  error. Fixed by extending the list of viable traits.
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.

5 participants