UnaryExpressionImpl extends PyTree implements UnaryExpression { @Override public InferredType type() { if (is(Kind.NOT)) { return InferredTypes.BOOL; } return InferredTypes.anyType(); } UnaryExpressionImpl(Token operator, Expression expression); @Override Token operator(); @Override Expression expression(); @Override void accept(TreeVisitor visitor); @Override List<Tree> computeChildren(); @Override Kind getKind(); @Override InferredType type();  }
@Test public void type() { assertThat(lastExpression("not 42").type()).isEqualTo(BOOL); assertThat(lastExpression("-42").type()).isEqualTo(InferredTypes.anyType()); assertThat(lastExpression("+42").type()).isEqualTo(InferredTypes.anyType()); assertThat(lastExpression("~42").type()).isEqualTo(InferredTypes.anyType()); }