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

Make pre- and post-conditions obey behavioral subtyping #5825

Merged
merged 120 commits into from
May 4, 2023

Conversation

mernst
Copy link
Member

@mernst mernst commented May 1, 2023

No description provided.

mernst and others added 30 commits April 27, 2023 11:30
…rnst/checker-framework into wpiPrepareMethodForWriting-parameters
@mernst mernst removed their assignment May 2, 2023
@mernst
Copy link
Member Author

mernst commented May 2, 2023

@smillst This is ready for your review.

Copy link
Member

@smillst smillst left a comment

Choose a reason for hiding this comment

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

I tried making test cases for this change, but I wasn't successful because I don't know when inference should be inferring pre/post conditions. (Can inference ever infer a precondition?) It would be helpful if this pull request contained at least one test case where a pre/post condition is inferred.

Pair<AnnotatedTypeMirror, AnnotatedTypeMirror> pair = entry.getValue();
AnnotatedTypeMirror inferredType = pair.first;
AnnotatedTypeMirror declaredType = pair.second;
if (otherIsSupertype ? isPrecondition : !isPrecondition) {
Copy link
Member

Choose a reason for hiding this comment

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

This can be moved outside the loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the common case, I expect the loop not to be entered.

@smillst smillst assigned mernst and unassigned smillst May 3, 2023
@mernst mernst changed the title Make @EnsuresCalledMethods obey behavioral subtyping Make pre- and post-conditions obey behavioral subtyping May 3, 2023
@mernst
Copy link
Member Author

mernst commented May 4, 2023

@smillst I have added tests and addressed your other feedback. Could you please re-review?

@mernst mernst assigned smillst and unassigned mernst May 4, 2023
Copy link
Member

@smillst smillst left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. This all makes a lot more sense to me now.

@smillst smillst enabled auto-merge (squash) May 4, 2023 18:26
@smillst smillst merged commit a274d91 into typetools:master May 4, 2023
@smillst smillst deleted the excess-ecm-2 branch May 4, 2023 20:16
wmdietl pushed a commit to eisop/checker-framework that referenced this pull request Oct 2, 2023
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.

3 participants