-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Allowed setters and getters to take additional arguments (superseded by #78991) #76665
Conversation
cb5fba7
to
c409ead
Compare
ca7ffea
to
0507a82
Compare
I noticed the tests complained about "name" shadowing a class variable. I wrote a few lines like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and reviewed this PR and added some changes: signature analysis, support for optional arguments (godotengine/godot-proposals#6107, vnen's comment), tests.
Commit: dalexeev@19b170a
Patch: review.patch.txt
You can apply the patch with git apply
or git am
(and then you need to squash the commits into one). You can credit me as a co-author if you wish.
Thanks for the review @dalexeev :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be one commit. Use rebase, don't merge master into your branch.
prop: prefix World! suffix | ||
prop: <null> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug. This is why I prefer not to use --gdscript-generate-tests
but to edit .out
manually, even if it's tedious.
my_float_alias = 2.0 | ||
my_int_alias = 3 | ||
print((my_float_alias == my_float) && (my_float == 2.0)) | ||
print((my_int_alias == my_int) && (my_int == 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file does not follow the GDScript style guide (wrong spaces, symbolic logical operators, missing trailing newline). This is undesirable in non-parser tests. In addition, I do not see the point in this test, in my opinion it duplicates the ones I have already added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was going to ask you about this test on Rocket. I had written this a week or two ago before your patch. I noticed it was redundant with your tests. I can remove it.
This comment was marked as outdated.
This comment was marked as outdated.
Thanks for preparing the squashed commit! Unless there's a rush to get the PR accepted, I want to see if I can figure out how to do it on my own, just for self-education. If there is a rush, let me know and I'll go ahead and apply the patch :) |
679f7c3
to
45c0ab6
Compare
Alright, I think I managed to figure out how to squash the commits and credit you. Thanks for the help :) |
45c0ab6
to
744056a
Compare
No, it doesn't look correct. You just rolled back to your old version and added my tests, but the rest of the changes were discarded (signature analysis, support for optional arguments, etc.). Also,
I ran the tests locally, on my PC they complete successfully. Also I tested manually, looks correct. Sorry for making the review in the form of an "ultimatum patch", I respect your desire to figure it out on your own. I just want to help you and save time, yours and mine. In any case, I want to say that as a first contribution, your work is already impressive! |
744056a
to
713cb8c
Compare
Thanks :) |
This comment was marked as resolved.
This comment was marked as resolved.
713cb8c
to
b1c5072
Compare
Nice. I'm recompiling on my machine just to test things out again. When I'm satisfied, I'll remove my draft status. |
b1c5072
to
78120ae
Compare
has_valid_setter = true; | ||
|
||
GDScriptParser::ParameterNode *value_arg = setter_function->parameters[setter_function->mandatory_parameter_count - 1]; | ||
if (setter_function->mandatory_parameter_count > 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (setter_function->mandatory_parameter_count > 2) { | |
if (setter_function->mandatory_parameter_count == 0 || setter_function->mandatory_parameter_count > 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it.
Thanks for the help and patience!
3acea5c
to
14aba97
Compare
I did some brief testing on my end and everything seemed to check out. I removed the draft status from my PR. I edited my original post so that it mentions being able to have optional arguments in the setters and getters. Should I edit the title of my PR as well, or will that mess something up? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! There is only a minor suggestion for naming CallError
variables. I think this PR is ready for review by the GDScript team.
Awesome :) So should I name the call errors to Also, what are the next steps for updating the documentation on setters/getters to reflect the changes? Should I start writing a PR to update the docs now, or wait until these changes are approved? |
It seems to me that the name
I don't think this is strictly regulated, but in practice PRs for docs and/or demo projects are usually opened after the PR in the main repository is merged. Since the docs cannot be updated before the main PR is merged. Plus, during the review process, you may be asked to make some changes, which will also require you to update the docs PR. Therefore, in my opinion, it is better to wait for the final version, so as not to do extra work. It's normal for the documentation (Manual) to be a bit behind the current state, no one expects it to be updated the same day a feature is in master. The exception is the Class Reference, since it's in the main repository, we try to keep it up to date. |
c738a72
to
f5c3662
Compare
Something failed in the Github Actions Workflow run that ran last week. It seemed unrelated to the changes on my branch, so I just updated my branch to be synced with the current upstream/master with the hopes that it will fix the problem. Is there a way for me to run the workflow tests locally so I don't have to wait on Github Actions to be sure the commit is okay? |
Yes, you can:
But this is only for your platform. Tests on GitHub run for different platforms and compilation flags. |
Ah, gotcha. The failure was on Linux and I have Windows, so I guess there's not much I can do but hope it passes this time :) |
f5c3662
to
e91fa45
Compare
Hi @dalexeev :) I updated my branch to be concurrent with master. Let me know if there's anything else I need to do to help the PR move along :) |
This is a new feature and therefore unlikely to be included in 4.1, as we are in feature freeze, so chances are it will have to wait for approval until after the release of 4.1, to focus on things for 4.1 (Hopefully that won't take too long either!) |
e91fa45
to
176d55a
Compare
Reworked the error messages as suggested. |
Need a rebase after #77129. |
176d55a
to
befc384
Compare
befc384
to
e044e13
Compare
You reset the branch to the base branch, which closes the PR automatically |
Superseded by: #78991 |
Closes godotengine/godot-proposals#6750.
Closes godotengine/godot-proposals#3096.
Closes godotengine/godot-proposals#6107 (discussion).
Closes #74144.
addresses the following proposals:
godotengine/godot-proposals#2817.
godotengine/godot-proposals#2983.
godotengine/godot-proposals#4867.
godotengine/godot-proposals#4868.
For example, the following is now possible:
Previously, one would have had to use a more verbose and tedious approach:
TODO: