PrimitiveOperations { @Nullable static Type getType(ExpressionTree leftOperand, ExpressionTree rightOperand, Tree.Kind operationKind) { if (COMPARATIVE_OPERATORS.contains(operationKind)) { return PrimitiveType.BOOLEAN; } else if (ARITHMETIC_OPERATORS.contains(operationKind)) { return PrimitiveType.INTEGER; } else { return getType(leftOperand.types().getUniqueKnownType(), rightOperand.types().getUniqueKnownType(), operationKind); } } private  PrimitiveOperations();   }
@Test public void test() { assertThat(PrimitiveOperations.getType(new PrefixExpressionTreeImpl(Tree.Kind.UNARY_MINUS, null,new IsExpressionTreeImpl(null, null, null, null, null) ))).isEqualTo(PrimitiveType.INTEGER); assertThat(PrimitiveOperations.getType(new PrefixExpressionTreeImpl(Tree.Kind.LOGICAL_COMPLEMENT, null,new IsExpressionTreeImpl(null, null, null, null, null) ))).isEqualTo(PrimitiveType.BOOLEAN); assertThat(PrimitiveOperations.getType(new PrefixExpressionTreeImpl(Tree.Kind.ARGUMENTS, null,new IsExpressionTreeImpl(null, null, null, null, null) ))).isEqualTo(null); }