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: mark MathOnFloatProcessor as incomplete #866

Merged
merged 9 commits into from
Aug 22, 2022
Merged

fix: mark MathOnFloatProcessor as incomplete #866

merged 9 commits into from
Aug 22, 2022

Conversation

algomaster99
Copy link
Member

One of the ignored tests was bothering me for some time so I though I should fix it. It turned out that resolving the bug stated in #570 required some more dependent fixes and refactoring so I proceeded with them as well. Here is the summary of the list of changes in this PR.

  1. MathOnFloatProcessor is marked as incomplete. It won't attempt to repair when the expected type of the CtVariable is float as it produces a non-compilable output.
  2. Minimise the number of casts we perform. SonarSource suggests that we should cast both of the operands to double, but that is not necessary as JVM implicitly does type coercion.
  3. Use type casting API in Spoon to add type cast.

binaryOperator.setType(getFactory().Type().doublePrimitiveType());
}
// We do not need to cast the type of the right hand operand as it is already a
// double
Copy link
Member Author

@algomaster99 algomaster99 Aug 19, 2022

Choose a reason for hiding this comment

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

@monperrus not related to autocompletion, but when I deleted the above code, the inline comment was suggested by co-pilot. 🤌🏼

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unbelievable!

Copy link
Contributor

Choose a reason for hiding this comment

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

crazy

@algomaster99 algomaster99 changed the title fix: mark MathOnFloatProcessor as incomplete DONOTMERGE: fix: mark MathOnFloatProcessor as incomplete Aug 21, 2022
@algomaster99
Copy link
Member Author

Please merge this once #868 is merged into this PR.

…p repairs for Incomplete cases (#868)

* Add test to verify that INCOMPLETE processor skip repairs

* Assert that the repaired file compiles

* Add docstrings

* Add information about `INCOMPLETE` processor tests

* Strengthen test
@algomaster99 algomaster99 changed the title DONOTMERGE: fix: mark MathOnFloatProcessor as incomplete fix: mark MathOnFloatProcessor as incomplete Aug 22, 2022
@khaes-kth
Copy link
Collaborator

That would be better if we could add a test to cover line 86 of this file: https://app.codecov.io/gh/SpoonLabs/sorald/compare/866/changes#D1L86

@khaes-kth khaes-kth merged commit c04ae77 into master Aug 22, 2022
@khaes-kth khaes-kth deleted the fix-S2164 branch August 22, 2022 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants