Skip to content

Commit

Permalink
Fix failing tests (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 13, 2024
1 parent 69d6071 commit 9c1c0b8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -71,7 +72,7 @@ else if(param instanceof SingleVariableDeclaration) {
this.parameters.add(parameter);
}
if(lambda.getBody() instanceof Block) {
this.body = new OperationBody(cu, sourceFolder, filePath, (Block)lambda.getBody(), this, activeVariableDeclarations, javaFileContent);
this.body = new OperationBody(cu, sourceFolder, filePath, (Block)lambda.getBody(), this, new HashMap<>(activeVariableDeclarations), javaFileContent);
}
else if(lambda.getBody() instanceof Expression) {
this.expression = new AbstractExpression(cu, sourceFolder, filePath, (Expression)lambda.getBody(), CodeElementType.LAMBDA_EXPRESSION_BODY, this, activeVariableDeclarations, javaFileContent);
Expand All @@ -88,7 +89,7 @@ public LambdaExpressionObject(CompilationUnit cu, String sourceFolder, String fi
this.asString = switchCaseBody.toString();
this.locationInfo = new LocationInfo(cu, sourceFolder, filePath, switchCaseBody, CodeElementType.LAMBDA_EXPRESSION);
if(switchCaseBody instanceof Block) {
this.body = new OperationBody(cu, sourceFolder, filePath, (Block)switchCaseBody, this, activeVariableDeclarations, javaFileContent);
this.body = new OperationBody(cu, sourceFolder, filePath, (Block)switchCaseBody, this, new HashMap<>(activeVariableDeclarations), javaFileContent);
}
else {
//TODO find a way to support switch-case with a single statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,15 @@
"codeElementType": "IF_STATEMENT",
"description": "statement referencing the original variable",
"codeElement": null
}, {
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
"startLine": 148,
"endLine": 148,
"startColumn": 11,
"endColumn": 120,
"codeElementType": "RETURN_STATEMENT",
"description": "statement referencing the original variable",
"codeElement": null
}],
"rightSideLocations": [{
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
Expand All @@ -533,6 +542,15 @@
"codeElementType": "IF_STATEMENT",
"description": "statement referencing the variable with changed type",
"codeElement": null
}, {
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
"startLine": 184,
"endLine": 184,
"startColumn": 11,
"endColumn": 120,
"codeElementType": "RETURN_STATEMENT",
"description": "statement referencing the variable with changed type",
"codeElement": null
}]
},
{
Expand Down
18 changes: 18 additions & 0 deletions src/test/resources/commandline/drill-gp-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3763,6 +3763,15 @@
"codeElementType": "IF_STATEMENT",
"description": "statement referencing the original variable",
"codeElement": null
}, {
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
"startLine": 148,
"endLine": 148,
"startColumn": 11,
"endColumn": 120,
"codeElementType": "RETURN_STATEMENT",
"description": "statement referencing the original variable",
"codeElement": null
}],
"rightSideLocations": [{
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
Expand All @@ -3782,6 +3791,15 @@
"codeElementType": "IF_STATEMENT",
"description": "statement referencing the variable with changed type",
"codeElement": null
}, {
"filePath": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/DistributedQueueParallelizer.java",
"startLine": 184,
"endLine": 184,
"startColumn": 11,
"endColumn": 120,
"codeElementType": "RETURN_STATEMENT",
"description": "statement referencing the variable with changed type",
"codeElement": null
}]
},
{
Expand Down

0 comments on commit 9c1c0b8

Please sign in to comment.