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

virtual func return type check implemented #38612

Conversation

ThakeeNathees
Copy link
Contributor

@ThakeeNathees ThakeeNathees commented May 10, 2020

@akien-mga akien-mga added this to the 4.0 milestone May 11, 2020
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label May 11, 2020
Comment on lines 7994 to 7995
if (!p_function->return_type.has_type)
p_function->return_type = return_type;
Copy link
Member

Choose a reason for hiding this comment

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

This should now use braces around the single-line block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@ThakeeNathees ThakeeNathees force-pushed the override-return-type-bug-fix branch from 190c37c to dbe6628 Compare July 7, 2020 09:40
@Calinou
Copy link
Member

Calinou commented Mar 20, 2021

Now that the new GDScript has been merged in the master branch, we should check if this functionality has already been implemented in the master branch. If so, maybe there's still value in reopening this pull request against the 3.x branch and merging it for 3.4.

@akien-mga
Copy link
Member

I tested and the case is in the second screenshot this PR is properly implemented in master:

func _override_return_int() -> String:
	return "str"

will raise an error.

When not typing the override though, it doesn't raise an error.

I opened #73153 to track it.

This PR is abandoned so closing.

@akien-mga akien-mga closed this Feb 12, 2023
@akien-mga akien-mga added archived and removed cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Feb 12, 2023
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.

Overwriten methods should default to the same return type as the super class's method
3 participants