@Override public PType caseAProperSubsetBinaryExp(
AProperSubsetBinaryExp node, TypeCheckInfo question)
throws AnalysisException
{
TypeCheckInfo noConstraint = question.newConstraint(null);
node.getLeft().apply(THIS, noConstraint);
node.getRight().apply(THIS, noConstraint);
PType ltype = node.getLeft().getType();
PType rtype = node.getRight().getType();
if (question.assistantFactory.createPTypeAssistant().isSet(ltype)
&& question.assistantFactory.createPTypeAssistant().isSet(rtype)
&& !question.assistantFactory.getTypeComparator().compatible(ltype, rtype))
{
TypeCheckerErrors.report(3335, "Subset will only be true if the LHS set is empty", node.getLocation(), node);
TypeCheckerErrors.detail("Left", ltype);
TypeCheckerErrors.detail("Right", rtype);
}
if (!question.assistantFactory.createPTypeAssistant().isSet(ltype))
{
TypeCheckerErrors.report(3146, "Left hand of " + node.getOp()
+ " is not a set", node.getLocation(), node);
}
if (!question.assistantFactory.createPTypeAssistant().isSet(rtype))
{
TypeCheckerErrors.report(3147, "Right hand of " + node.getOp()
+ " is not a set", node.getLocation(), node);
}
node.setType(AstFactory.newABooleanBasicType(node.getLocation()));
return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation());
}