public void testRegexTypeChecking2() throws Throwable {
LogicalExpressionPlan plan = new LogicalExpressionPlan();
ConstantExpression constant1 = new ConstantExpression(plan, new DataByteArray());
ConstantExpression constant2 = new ConstantExpression(plan, "Regex");
RegexExpression regex = new RegexExpression(plan, constant1, constant2);
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
expTypeChecker.visit();
printMessageCollector(collector);
//printTypeGraph(plan);
// After type checking
if (collector.hasError()) {
throw new Exception("Error not expected during type checking");
}
// check type
System.out.println(DataType.findTypeName(regex.getType()));
assertEquals(DataType.BOOLEAN, regex.getType());
// check wiring
CastExpression cast = (CastExpression) regex.getLhs();
assertEquals(cast.getType(), DataType.CHARARRAY);
assertEquals(cast.getExpression(), constant1);
}