public void testCantSimplifyCast() {
   Number number = new Number(2);
   Cast cast = new Cast(number);
   cast.type = IntegerType.instance;
   ExpressionVisitor visitor = new ExpressionVisitor(new SymbolTable());
   assertEquals(cast, visitor.visit(cast));
 }
 public void testLongToInt() {
   IdExpression expression = new IdExpression("l");
   expression.type = LongType.instance;
   Cast cast = new Cast(expression);
   cast.type = IntegerType.instance;
   ExpressionVisitor visitor = new ExpressionVisitor(new SymbolTable());
   assertEquals(cast, visitor.visit(cast));
 }
 public void testDowncast() {
   SymbolTableForTests table = new SymbolTableForTests();
   table.addClasses("A", "B");
   table.getClass("B").superName = "A";
   Expression expression = new IdExpression("a");
   expression.type = new IdType("A");
   ExpressionVisitor visitor = new ExpressionVisitor(table);
   Cast cast = new Cast(expression);
   cast.type = new IdType("B");
   assertEquals(visitor.visit(cast), cast);
 }