public Object visit(TernaryExpression node) {
            Expression condition = node.getCondition();
            Expression thenPart = node.getThenPart();
            Expression elsePart = node.getElsePart();

            check(condition);
            if (condition == thenPart) {
                check(elsePart);
            }
            else {
                check(thenPart);
                check(elsePart);
            }

            // TODO: allow condition to support isa and propogate the type
            //       into the variables of then/else similar to if-statement

            // set expression to common type of if/else statement
            Type type = null;
            Type thenType = thenPart.getType();
            Type elseType = elsePart.getType();
            if (thenType == null) { type = elseType; }
            else if (elseType == null) { type = thenType; }
            else { type = thenType.getCompatibleType(elseType); }

            node.setType(type);
            if (thenPart != null) {
                thenPart.convertTo(type);
            }
            if (elsePart != null) {
                elsePart.convertTo(type);
            }

            return null;
        }