ConstantExpression constant4 = new ConstantExpression(plan, true);
SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2);
GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3);
AndExpression and1 = new AndExpression(plan, gt1, constant4);
NotExpression not1 = new NotExpression(plan, and1);
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
expTypeChecker.visit();
printMessageCollector(collector);
//printTypeGraph(plan);
if (collector.hasError()) {
throw new Exception("Error not expected during type checking");
}
// Induction check
assertEquals(DataType.INTEGER, sub1.getType());
assertEquals(DataType.BOOLEAN, gt1.getType());
assertEquals(DataType.BOOLEAN, and1.getType());
assertEquals(DataType.BOOLEAN, not1.getType());
// Cast insertion check
assertEquals(DataType.INTEGER, sub1.getRhs().getType());
assertEquals(DataType.LONG, gt1.getLhs().getType());