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

Improved stability of isDerivedFrom decisions #1488

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

oxisto
Copy link
Member

@oxisto oxisto commented Mar 31, 2024

This PR adds the way Type.isDerivedFrom works. More concretly, we are once again taking the "wrap state" of the type into account. This means that pointer types and non-pointer types will not match even though their root types derive from each other. This was the way this function behaved in the past and it seems this was changed at some point.

This behaviour seems to be less-error prone because it led to some weird over-approximations in call resolving, basically ignoring wether a type was a pointer or not. To replicate the behaviour previous to the PR, you can use type.root.isDerivedFrom(other.root), if you really want to just match the root types.

@oxisto oxisto requested a review from konradweiss as a code owner March 31, 2024 20:14
@oxisto oxisto force-pushed the improve-derived-from branch from 2b11c7d to 24e2694 Compare March 31, 2024 20:52
@oxisto oxisto enabled auto-merge (squash) April 4, 2024 17:01
This PR adds the way `Type.isDerivedFrom` works. More concretly, we are once again taking the "wrap state" of the type into account. This means that pointer types and non-pointer types will not match even though their root types derive from each other. This was the way this function behaved in the past and it seems this was changed at some point, which led to some weird over-approximations in call resolving, basically ignoring wether a type was a pointer or not.
@oxisto oxisto force-pushed the improve-derived-from branch from 24e2694 to 4ef9cfd Compare April 4, 2024 17:15
@oxisto oxisto requested a review from peckto as a code owner April 4, 2024 17:15
Copy link

sonarqubecloud bot commented Apr 4, 2024

@oxisto oxisto merged commit 6d3bb29 into main Apr 4, 2024
3 checks passed
@oxisto oxisto deleted the improve-derived-from branch April 4, 2024 17:20
oxisto added a commit that referenced this pull request Apr 4, 2024
This PR adds the way `Type.isDerivedFrom` works. More concretly, we are once again taking the "wrap state" of the type into account. This means that pointer types and non-pointer types will not match even though their root types derive from each other. This was the way this function behaved in the past and it seems this was changed at some point, which led to some weird over-approximations in call resolving, basically ignoring wether a type was a pointer or not.
maximiliankaul pushed a commit that referenced this pull request Apr 18, 2024
This PR adds the way `Type.isDerivedFrom` works. More concretly, we are once again taking the "wrap state" of the type into account. This means that pointer types and non-pointer types will not match even though their root types derive from each other. This was the way this function behaved in the past and it seems this was changed at some point, which led to some weird over-approximations in call resolving, basically ignoring wether a type was a pointer or not.
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.

None yet

2 participants