@Override public PType caseAClassInvariantDefinition(AClassInvariantDefinition node, TypeCheckInfo question) throws AnalysisException { Environment newEnv = new FlatEnvironment(question.assistantFactory, question.env, true); newEnv.setEnclosingDefinition(node); TypeCheckInfo functional = question.newInfo(newEnv); functional.qualifiers = null; functional.scope = NameScope.NAMESANDSTATE; PType type = node.getExpression().apply(THIS, functional); if (!question.assistantFactory.createPTypeAssistant().isType(type, ABooleanBasicType.class)) { TypeCheckerErrors.report(3013, "Class invariant is not a boolean expression", node.getLocation(), node); } node.setType(type); return node.getType(); }
PType actual = node.getMeasure().apply(THIS, question.newInfo(local)); node.setMeasureName(node.getName().getMeasureName(node.getName().getLocation())); checkMeasure(question, node, node.getMeasureName(), actual);
@Override public PType caseACyclesStm(ACyclesStm node, TypeCheckInfo question) throws AnalysisException { PDefinition encl = question.env.getEnclosingDefinition(); if (encl != null && encl.getAccess().getPure()) { TypeCheckerErrors.report(3346, "Cannot use cycles in pure operations", node.getLocation(), node); } Environment newEnv = new FlatEnvironment(question.assistantFactory, question.env, true); TypeCheckInfo functional = question.newInfo(newEnv); PType argType = node.getCycles().apply(THIS, functional); if (!question.assistantFactory.getTypeComparator().compatible(AstFactory.newANatNumericBasicType(node.getLocation()), argType)) { TypeCheckerErrors.report(3282, "Arguments to cycles must be a nat", node.getLocation(), node); TypeCheckerErrors.detail("Actual", argType); } return node.getStatement().apply(THIS, question); }
@Override public PType caseADurationStm(ADurationStm node, TypeCheckInfo question) throws AnalysisException { PDefinition encl = question.env.getEnclosingDefinition(); if (encl != null && encl.getAccess().getPure()) { TypeCheckerErrors.report(3346, "Cannot use duration in pure operations", node.getLocation(), node); } Environment newEnv = new FlatEnvironment(question.assistantFactory, question.env, true); TypeCheckInfo functional = question.newInfo(newEnv); PType argType = node.getDuration().apply(THIS, functional); if (!question.assistantFactory.getTypeComparator().compatible(AstFactory.newANatNumericBasicType(node.getLocation()), argType)) { TypeCheckerErrors.report(3281, "Arguments to duration must be a nat", node.getLocation(), node); TypeCheckerErrors.detail("Actual", argType); } return node.getStatement().apply(THIS, question); }
@Override public PType caseAMapCompMapExp(AMapCompMapExp node, TypeCheckInfo question) throws AnalysisException { PDefinition def = AstFactory.newAMultiBindListDefinition(node.getLocation(), node.getBindings()); def.apply(THIS, question.newConstraint(null)); Environment local = new FlatCheckedEnvironment(question.assistantFactory, def, question.env, question.scope); PExp predicate = node.getPredicate(); TypeCheckInfo pquestion = new TypeCheckInfo(question.assistantFactory, local, question.scope, null, AstFactory.newABooleanBasicType(node.getLocation()), null); if (predicate != null && !question.assistantFactory.createPTypeAssistant().isType(predicate.apply(THIS, pquestion), ABooleanBasicType.class)) { TypeCheckerErrors.report(3118, "Predicate is not boolean", predicate.getLocation(), predicate); } node.setType(node.getFirst().apply(THIS, question.newInfo(local))); local.unusedCheck(); return node.getType(); }
question = question.newInfo(local); c.setType(c.getResult().apply(rootVisitor, question)); local.unusedCheck();
PType rtype = question.assistantFactory.createPTypeAssistant().typeResolve(node.getImportType(), null, THIS, question.newInfo(params)); node.setImportType(rtype);
TypeCheckInfo newQuestion = question.newInfo(params); PType type = question.assistantFactory.createPTypeAssistant().typeResolve(exp.getExportType(), null, THIS, newQuestion); exp.setExportType(type); TypeCheckInfo newQuestion = question.newInfo(params); PType type = question.assistantFactory.createPTypeAssistant().typeResolve(exp.getExportType(), null, THIS, newQuestion); exp.setExportType(type);
TypeCheckInfo functional = question.newInfo(newEnv);
TypeCheckInfo functional = question.newInfo(newEnv);