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

Specs for: Add __traits(getCmdlineConstant) #3615

Closed
wants to merge 1 commit into from

Conversation

ErnyTech
Copy link

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ErnyTech! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@PetarKirov
Copy link
Member

PetarKirov commented May 26, 2023

Note: the DAutoTest build is failing:

Test the D Language specification
../dmd/generated/linux/release/64/dmd -run tools/dspec_tester.d --compiler=../dmd/generated/linux/release/64/dmd
---
// compiler defined constans: mymod.test1=some_text, mymod.test2=4

module mymod;
pragma(msg, __traits(getCmdlineConstant, "test1"));   // Prints "some_text"
pragma(msg, __traits(getCmdlineConstant, "mymod.test1")); // Prints "some_text"
pragma(msg, __traits(getCmdlineConstant, "test2", false)); // Prints string "4"
pragma(msg, __traits(getCmdlineConstant, "test2", int)); // Prints integer 4
pragma(msg, __traits(getCmdlineConstant, "test3", int, 2)); // Constant not passed to dmd --> fallback default -> Prints integer 2

---
__stdin.d(4): Error: unrecognized trait `getCmdlineConstant`
__stdin.d(4):        while evaluating `pragma(msg, __traits(getCmdlineConstant, "test1"))`
__stdin.d(5): Error: unrecognized trait `getCmdlineConstant`
__stdin.d(5):        while evaluating `pragma(msg, __traits(getCmdlineConstant, "mymod.test1"))`
__stdin.d(6): Error: unrecognized trait `getCmdlineConstant`
__stdin.d(6):        while evaluating `pragma(msg, __traits(getCmdlineConstant, "test2", false))`
__stdin.d(7): Error: unrecognized trait `getCmdlineConstant`
__stdin.d(7):        while evaluating `pragma(msg, __traits(getCmdlineConstant, "test2", int))`
__stdin.d(8): Error: unrecognized trait `getCmdlineConstant`
__stdin.d(8):        while evaluating `pragma(msg, __traits(getCmdlineConstant, "test3", int, 2))`

This is expected as the dmd PR is not yet merged. @ErnyTech please do git commit --amend --no-edit && git push -f to restart the build once the dmd PR is merged.

@ErnyTech ErnyTech marked this pull request as ready for review May 26, 2023 15:00
@dkorpel
Copy link
Contributor

dkorpel commented Dec 18, 2023

Closing this since dlang/dmd#15257 was closed

@dkorpel dkorpel closed this Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants