8074148: Attr.visitBinary flags error at wrong position
Reviewed-by: vromero
This commit is contained in:
parent
c4ebb7f3c0
commit
f1f1f0f7e1
@ -2942,7 +2942,7 @@ public class Attr extends JCTree.Visitor {
|
||||
public void visitBinary(JCBinary tree) {
|
||||
// Attribute arguments.
|
||||
Type left = chk.checkNonVoid(tree.lhs.pos(), attribExpr(tree.lhs, env));
|
||||
Type right = chk.checkNonVoid(tree.lhs.pos(), attribExpr(tree.rhs, env));
|
||||
Type right = chk.checkNonVoid(tree.rhs.pos(), attribExpr(tree.rhs, env));
|
||||
// Find operator.
|
||||
Symbol operator = tree.operator = operators.resolveBinary(tree, tree.getTag(), left, right);
|
||||
Type owntype = types.createErrorType(tree.type);
|
||||
|
14
langtools/test/tools/javac/expression/BinopVoidTest.java
Normal file
14
langtools/test/tools/javac/expression/BinopVoidTest.java
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8074148
|
||||
* @summary Attr.visitBinary flags error at wrong position
|
||||
*
|
||||
* @compile/fail/ref=BinopVoidTest.out -XDrawDiagnostics BinopVoidTest.java
|
||||
*/
|
||||
|
||||
class BinopVoidTest {
|
||||
void foo() {}
|
||||
int x = 10 + foo();
|
||||
int y = foo() + 10;
|
||||
int z = foo() + foo();
|
||||
}
|
5
langtools/test/tools/javac/expression/BinopVoidTest.out
Normal file
5
langtools/test/tools/javac/expression/BinopVoidTest.out
Normal file
@ -0,0 +1,5 @@
|
||||
BinopVoidTest.java:11:21: compiler.err.void.not.allowed.here
|
||||
BinopVoidTest.java:12:16: compiler.err.void.not.allowed.here
|
||||
BinopVoidTest.java:13:16: compiler.err.void.not.allowed.here
|
||||
BinopVoidTest.java:13:24: compiler.err.void.not.allowed.here
|
||||
4 errors
|
Loading…
Reference in New Issue
Block a user