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

[GDScript] Fix get_argument_count for lambda Callables #93964

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

AThousandShips
Copy link
Member

@AThousandShips AThousandShips added this to the 4.3 milestone Jul 5, 2024
@AThousandShips AThousandShips requested a review from a team as a code owner July 5, 2024 07:54
@AThousandShips AThousandShips changed the title [GDScript] Fix get_argument_count for lambda Callables [GDScript] Fix get_argument_count for lambda Callables Jul 5, 2024
@AThousandShips
Copy link
Member Author

AThousandShips commented Jul 5, 2024

Will check the difference with self and non-self callables and check both for completeness, will update in a bit when I've confirmed the cases

Edit: Done

@dalexeev
Copy link
Member

dalexeev commented Jul 5, 2024

The tests are overcomplicated, you can simply use:

var a: int
var lambda := func (x: int) -> void:
    print(a, x)
print(lambda.get_argument_count()) # Should print 1, prints 2 in master.

@AThousandShips
Copy link
Member Author

AThousandShips commented Jul 5, 2024

Sure, can remove the extra cases, but will keep separate cases for self/non-self to get full coverage

Edit: will redo the test one moment

@akien-mga akien-mga merged commit 33f456c into godotengine:master Jul 5, 2024
18 checks passed
@AThousandShips AThousandShips deleted the lambda_arg_fix branch July 5, 2024 13:15
@akien-mga
Copy link
Member

Thanks!

@AThousandShips
Copy link
Member Author

Thank you!

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.

get_argument_count() on Callable class reporting nested lamda calls as additional arguments.
3 participants