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

[stdlib] Change msg argument in assert_true/assert_false/... to keyword-only #2739

Open
wants to merge 14 commits into
base: nightly
Choose a base branch
from

Conversation

softmaxer
Copy link

@softmaxer softmaxer commented May 18, 2024

changes:

  • Add * in function definitions of stdlib/src/testing/testing.mojo to separate variadic and keyword only arguments.
  • Scan for call sites of these assert functions and replace assert_true(val, msg) to assert_true(val, msg=msg) for both assert_true and assert_false

Normally, This should fix #2487 .
If any other changes are needed, Please let me know!

As mentioned by a colleague on discord:

The change is meant to remove a footgun caused by implicit conversion

Reference issue: #2475

@jackos @JoeLoser As discussed in the Previous PR #2490 which was closed due to unnecessary commits, I am reopening the same PR again, this time I hope the same issues from the last PR don't exist.

This is failing one test in the file test_memory.mojo and I don't quite see why.
I think I figured it out, I accidentally deleted one line in a test function, sorry :p . I added it back now.

@softmaxer softmaxer requested review from a team as code owners May 18, 2024 13:21
@softmaxer softmaxer changed the title Issue #2487: Changing argument msg in assert_true/assert_false/... to Keyword only [stdlib] Issue #2487: Changing argument msg in assert_true/assert_false/... to Keyword only May 18, 2024
@softmaxer softmaxer force-pushed the fix/msg-kw-arg branch 5 times, most recently from 20d70de to 0d51613 Compare May 24, 2024 14:25
@laszlokindrat laszlokindrat self-assigned this May 28, 2024
@laszlokindrat
Copy link
Contributor

Thanks for the patch! It would be great to have this, but I don't see the changes to the actual assert_* functions; did something go wrong during a rebase? Also, please make sure you mention this in the changelog!

@@ -2,7 +2,7 @@ name: Documentation issue
description: Report a problem with the Mojo docs
title: "[Docs]"
labels:
- documentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these changes for?

Copy link
Author

@softmaxer softmaxer May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! so yeah this was a commit that was not intended. I tried reverting it but didn't work out. I will try again. I also had another commit that was not intended, both of those happened during a rebase and one of them was not signed off by me so it failed a DCO, I asked for help on the discord but I didnt' get a response regarding that so I just waited for someone to review this PR. Overall, I have had some problems with the commit sign off even in the past because it doesn't detect my git config global.email sometimes, but it's my own issue so I would also love to know if there is a way to sign off a specific commit from the past maybe? That would be really helpful for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. @JoeLoser do you know how to help with this DCO issue?

@laszlokindrat laszlokindrat changed the title [stdlib] Issue #2487: Changing argument msg in assert_true/assert_false/... to Keyword only [stdlib] Change msg argument in assert_true/assert_false/... to keyword-only May 28, 2024
@softmaxer
Copy link
Author

softmaxer commented May 28, 2024

Thanks for the patch! It would be great to have this, but I don't see the changes to the actual assert_* functions; did something go wrong during a rebase? Also, please make sure you mention this in the changelog!

Yes! I think something went wrong during a rebase, I'm gonna make a new commit!

PS: Just updated the changelog as well.

softmaxer and others added 11 commits May 28, 2024 13:30
…t for msg

Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
Update the default labels for the issues created via the
issue-templates.

---------

Signed-off-by: Goldie Gadde <43185254+goldiegadde@users.noreply.github.com>
Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
… argument

Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
Signed-off-by: Sriram Vadlamani <sriram.vadlamani@proton.me>
docs/changelog.md Outdated Show resolved Hide resolved
Co-authored-by: Laszlo Kindrat <laszlokindrat@gmail.com>
Signed-off-by: Sriram Vadlamani <116822494+softmaxer@users.noreply.github.com>
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.

None yet

4 participants