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

Get arithmetic operation kind for compound assignments #388

Merged
merged 4 commits into from
Mar 7, 2022

Conversation

d367wang
Copy link

@d367wang d367wang commented Feb 19, 2022

A split of #331

  1. Get arithmetic operation kind for compound assignments
  2. Small tweaks on parameters of SlotManager.createArithmeticVariableSlot

Co-authored-by: Jenny Xiang j.tt.xiang@gmail.com

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks @d367wang !

src/checkers/inference/DefaultSlotManager.java Outdated Show resolved Hide resolved
src/checkers/inference/DefaultSlotManager.java Outdated Show resolved Hide resolved
src/checkers/inference/SlotManager.java Outdated Show resolved Hide resolved
@@ -155,7 +155,7 @@
* @return the ArithmeticVariableSlot for the given location
*/
ArithmeticVariableSlot createArithmeticVariableSlot(
AnnotationLocation location, AnnotatedTypeMirror lhsAtm, AnnotatedTypeMirror rhsAtm);
AnnotationLocation location, TypeMirror lhs, TypeMirror rhs);
Copy link
Member

Choose a reason for hiding this comment

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

The names/comments in the javadoc above also need to be updated.

src/checkers/inference/model/ArithmeticConstraint.java Outdated Show resolved Hide resolved
src/checkers/inference/model/ArithmeticConstraint.java Outdated Show resolved Hide resolved
src/checkers/inference/model/ArithmeticConstraint.java Outdated Show resolved Hide resolved
@@ -601,7 +598,7 @@ private TypeKind getArithmeticResultKind(AnnotatedTypeMirror lhsAtm, AnnotatedTy

@Override
public ArithmeticVariableSlot createArithmeticVariableSlot(
AnnotationLocation location, AnnotatedTypeMirror lhsAtm, AnnotatedTypeMirror rhsAtm) {
AnnotationLocation location, TypeMirror lhs, TypeMirror rhs) {
Copy link
Member

Choose a reason for hiding this comment

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

Why are there no calls to this method that need to be changed?

Copy link
Author

Choose a reason for hiding this comment

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

Because ArithmeticVariableSlots are only created in the value-inference downstream

@@ -577,14 +577,11 @@ public ExistentialVariableSlot createExistentialVariableSlot(Slot potentialSlot,

/**
* Determine the type kind of an arithmetic operation, based on Binary Numeric Promotion in JLS 5.6.2.
* @param lhsAtm atm of left operand
* @param rhsAtm atm of right operand
* @param lhsType type of left operand
Copy link
Member

Choose a reason for hiding this comment

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

Could you break this PR into two, one for compound assignments and one for these parameter type changes?

@d367wang d367wang assigned wmdietl and unassigned d367wang and wmdietl Mar 5, 2022
@wmdietl wmdietl merged commit 659bf69 into opprop:master Mar 7, 2022
@wmdietl
Copy link
Member

wmdietl commented Mar 7, 2022

@d367wang Thanks! Is there a follow-up PR for the createArithmeticVariableSlot changes?

@d367wang d367wang deleted the value-patch-1 branch March 7, 2022 23:29
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.

2 participants