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

Fix handling of Java contravariance #3092

Merged
merged 2 commits into from Aug 4, 2023

Conversation

juliamcclellan
Copy link
Contributor

Previously, because PsiWildcardTypes have an implicit bound of extends Object, a wildcard type with a super bound was being turned into a Covariance instead of a Contravariance.

Fixes #3091

Comment on lines 453 to 454
with((this / "java" / "Foo").cast<DClass>()) {
for (function in functions) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you make the test stricter?
If one of these functions would be filtered out for some reason, the test will be passed.
You can use our DSL:
with((this / "java" / "Foo" / "superBound").cast<DFunction>())

@juliamcclellan
Copy link
Contributor Author

Thanks for the review. Good point, I updated the test to include assertions that the three functions are present.

Copy link
Member

@IgnatBeresnev IgnatBeresnev left a comment

Choose a reason for hiding this comment

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

Thank you!

@IgnatBeresnev IgnatBeresnev merged commit e7af2fd into Kotlin:master Aug 4, 2023
6 checks passed
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.

Java contravariant type is represented as Covariant
3 participants