@Override public PType caseASetDifferenceBinaryExp(
ASetDifferenceBinaryExp 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))
{
TypeCheckerErrors.report(3160, "Left hand of '\\' is not a set", node.getLocation(), node);
}
if (!question.assistantFactory.createPTypeAssistant().isSet(rtype))
{
TypeCheckerErrors.report(3161, "Right hand of '\\' is not a set", node.getLocation(), node);
}
if (!question.assistantFactory.getTypeComparator().compatible(ltype, rtype))
{
TypeCheckerErrors.report(3162, "Left and right of '\\' are different types", node.getLocation(), node);
TypeCheckerErrors.detail2("Left", ltype, "Right", rtype);
}
if (ltype instanceof ASet1SetType)
{
ASet1SetType set1 = (ASet1SetType) ltype;
ltype = AstFactory.newASetSetType(node.getLocation(), set1.getSetof());
}
node.setType(ltype);
return ltype;
}