@Override public PType caseASetRangeSetExp(ASetRangeSetExp node,
TypeCheckInfo question) throws AnalysisException
{
PExp first = node.getFirst();
PExp last = node.getLast();
question.qualifiers = null;
node.setFtype(first.apply(THIS, question.newConstraint(null)));
question.qualifiers = null;
node.setLtype(last.apply(THIS, question.newConstraint(null)));
PType ftype = node.getFtype();
PType ltype = node.getLtype();
if (!question.assistantFactory.createPTypeAssistant().isNumeric(ftype))
{
TypeCheckerErrors.report(3166, "Set range type must be a number", first.getLocation(), ftype);
ftype = AstFactory.newAIntNumericBasicType(node.getLocation());
}
SNumericBasicType ntype = question.assistantFactory.createPTypeAssistant().getNumeric(ftype);
if (question.assistantFactory.createSNumericBasicTypeAssistant().getWeight(ntype)
> 1)
{
ftype = AstFactory.newAIntNumericBasicType(node.getLocation());
}
if (!question.assistantFactory.createPTypeAssistant().isNumeric(ltype))
{
TypeCheckerErrors.report(3167, "Set range type must be a number", last.getLocation(), ltype);
}
node.setType(AstFactory.newASetSetType(first.getLocation(), ftype));
return question.assistantFactory.createPTypeAssistant().possibleConstraint(question.constraint, node.getType(), node.getLocation());
}