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

Issue 975 Bugfix TypeAssigner, TypePromotionVisitor filter Constants #985

Merged
merged 6 commits into from
Jul 26, 2024

Conversation

sahilagichani14
Copy link
Collaborator

run tc using java8 or add new DefaultRTJarAnalysisInputLocation() input location in view

@@ -56,6 +56,13 @@ public static boolean isIntermediateType(Type type) {
}

public void visit(@Nonnull Value value, @Nonnull Type stdType, @Nonnull Stmt stmt) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we be more specific?

Suggested change
public void visit(@Nonnull Value value, @Nonnull Type stdType, @Nonnull Stmt stmt) {
public void visit(@Nonnull Local value, @Nonnull Type stdType, @Nonnull Stmt stmt) {

Copy link
Collaborator Author

@sahilagichani14 sahilagichani14 Jul 18, 2024

Choose a reason for hiding this comment

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

we are calling visit function with many different types JInstanceOfExpr, JNewArrayExpr etc so changing in parameter directly won't solve.

  1. if (value instanceof Constant) {return;} I tried this as well instead of [if (!(value instanceof Local))] with different jars but seems like no other special case than Constant so could keep just the check for Constant as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

regarding 1st point, I found a TC where if we don't promote just constants, it would lead to an invalid type for int1 type to boolean. so reverted

@sahilagichani14 sahilagichani14 force-pushed the issue-975-typeresolver branch from 1481a7e to 5190cfe Compare July 18, 2024 16:36
@sahilagichani14 sahilagichani14 changed the title Issue 975 Bugfix TypeAssigner Issue 975 Bugfix TypeAssigner, TypePromotionVisitor filter Constants Jul 18, 2024
Comment on lines 59 to 65

/* Note: When visiting function parameters, we may encounter constant values such as strings ("abc") or integers (2).
These constants are not instances of the Local class and should be handled accordingly.
*/
if (!(value instanceof Local)) {
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please make the comment more specific that we are possibly over-approximating here and if things break in future it might be due to this.

@stschott stschott merged commit b7ba8cd into develop Jul 26, 2024
7 checks passed
@stschott stschott deleted the issue-975-typeresolver branch July 26, 2024 09:02
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.

[Bug]: TypeResolver AssertionError for String methods expecting CharSequence invoked via String literal
3 participants