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: Add return type covariance and parameter type contravariance #82477

Merged

Conversation

dalexeev
Copy link
Member

@bitbrain
Copy link
Contributor

@dalexeev thank you so much for this! I remember from our discussion that in the codebase we have several places where we need to know if "something is a covariant of something else":

  1. would it make sense to create a dedicated method for it (used by the analyzer) rather than having it baked into the analyzer?
  2. are there currently other places in the codebase that could benefit from this method? I remember you mentioned that there are multiple places where we may require to check for "is type X of type Y"

@dalexeev
Copy link
Member Author

would it make sense to create a dedicated method for it

Currently no, we are close to feature freeze and release, this is not the time for unreasonable changes. But I have two draft branches: one is an attempt to refactor is_type_compatible() method and the other is an attempt to refactor DataType class.

@dalexeev
Copy link
Member Author

@YuriSizov YuriSizov merged commit b25f1f9 into godotengine:master Sep 28, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

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.

Support covariant return types for overriding functions
4 participants