Skip to content

Commit

Permalink
Errors running builder 'Java Builder' on project 'org.eclipse.tycho.c…
Browse files Browse the repository at this point in the history
…ore.shared'. (#1236)


fixes #520
  • Loading branch information
stephan-herrmann authored Jul 14, 2023
1 parent 9b70716 commit 0967ee6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ public TypeBinding resolveTypeInternal(BlockScope upperScope) {
for (int i = 0; i < resultExpressionsCount; i++) {
Expression resultExpr = this.resultExpressions.get(i);
TypeBinding origType = this.originalTypeMap.get(resultExpr);
if (origType == null || origType.kind() == Binding.POLY_TYPE) {
// NB: if origType == null we assume that initial resolving failed hard, rendering re-resolving impossible
if (origType != null && origType.kind() == Binding.POLY_TYPE) {
this.finalValueResultExpressionTypes[i] = this.originalValueResultExpressionTypes[i] =
resultExpr.resolveTypeExpecting(upperScope, this.expectedType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6296,4 +6296,36 @@ public void testGHIssue53() {
"Continue out of switch expressions not permitted\n" +
"----------\n");
}

public void testGH520() throws Exception {
runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void test(int i) {\n" +
" foo(switch (i) {\n" +
" case 0 -> m.call();\n" +
" default -> null;\n" +
" });\n" +
" }\n" +
" <T> void foo(T t) { }\n" +
"}\n"
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" foo(switch (i) {\n" +
" ^^^\n" +
"The method foo(T) in the type X is not applicable for the arguments (switch (i) {\n" +
"case 0 ->\n" +
" m.call();\n" +
"default ->\n" +
" null;\n" +
"})\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" case 0 -> m.call();\n" +
" ^\n" +
"m cannot be resolved\n" +
"----------\n");
}
}

0 comments on commit 0967ee6

Please sign in to comment.