Skip to content

Unify real expression in U{FreeIdent,Repeated}Test #32

Merged
rickie merged 3 commits into
rossendrijver/refaster_simple_returnfrom
rossendrijver/refaster_simple_return_fix
Jul 4, 2022
Merged

Unify real expression in U{FreeIdent,Repeated}Test #32
rickie merged 3 commits into
rossendrijver/refaster_simple_returnfrom
rossendrijver/refaster_simple_return_fix

Conversation

@rickie

@rickie rickie commented Jun 7, 2022

Copy link
Copy Markdown
Member

❗ This PR is on top of #4

In #4 we introduce additional logic to filter out invalid expressions in UFreeIdent, see here.
However, when this code got introduced in this commit c2e14f2, it broke our code.

The test cases in the UFreeIdentTest and URepeatedTest are not "valid"/"realistic" enough and therefore results in an IllegalArgumentException in ASTHelpers#getSymbol(MethodInvocationTree).

To make our code compatible with this change, we changed the tests to use BugCheckers for the two tests. This way we can use the same assertions but use real expressions that are accepted by ASTHelpers#getSymbol.

Once we merge this PR we can also rebase #4 with master.

@rickie
rickie requested a review from Stephan202 June 7, 2022 08:12

@rickie rickie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Some context.

}

@BugPattern(
name = "UnificationChecker",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

After merging the PR, we can rebase it and also drop the name field here and below.

@rickie
rickie force-pushed the rossendrijver/refaster_simple_return_fix branch from 45120d2 to 20508e2 Compare June 9, 2022 08:02
@rickie

rickie commented Jun 27, 2022

Copy link
Copy Markdown
Member Author

@Stephan202 , do you have time for a last pass? (We already discussed this twice offline 😄, I think it is good to go)

@Stephan202 Stephan202 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for my tardiness; added a commit :)

Unifier unifier = new Unifier(new Context());
UFreeIdent ident = UFreeIdent.create("foo");

assertThat(ident.unify(tree.getExpression(), unifier)).isNotNull();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can avoid the .getExpression() calls if we use a MethodInvocationTreeMatcher instead.

@rickie
rickie merged commit 3b86713 into rossendrijver/refaster_simple_return Jul 4, 2022
@rickie
rickie deleted the rossendrijver/refaster_simple_return_fix branch July 4, 2022 10:46
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.

2 participants