public StateInvariantObligation(AExplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.STATE_INV, ctxt, def.getLocation(), af); assistantFactory = af; // After def.getName() constructor body stitch = invDefs(def.getClassDefinition()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
private TypeCompatibilityObligation(AExplicitOperationDefinition def, PType actualResult, IPOContextStack ctxt, IPogAssistantFactory assistantFactory) throws AnalysisException { super(def, POType.TYPE_COMP, ctxt, def.getLocation(), assistantFactory); this.assistantFactory = assistantFactory; AVariableExp result = AstFactory.newAVariableExp(new LexNameToken(def.getName().getModule(), "RESULT", def.getLocation())); stitch = oneType(false, result, ((AOperationType) def.getType()).getResult().clone(), actualResult.clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public OperationPostConditionObligation(AExplicitOperationDefinition op, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_POST_CONDITION, ctxt, op.getLocation(), af); PExp pred = buildExp(op.getPrecondition(), op.getPostcondition().clone(), null); stitch = pred; valuetree.setPredicate(ctxt.getPredWithContext(pred)); }
public ParameterPatternObligation(AExplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.OPERATION_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; stitch = generate(def.getPredef(), cloneListPatternList(assistantFactory.createAExplicitOperationDefinitionAssistant().getParamPatternList(def)), cloneListType(((AOperationType) def.getType()).getParameters()), ((AOperationType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
LexNameToken result = new LexNameToken(d.getName().getModule(), "RESULT", d.getLocation()); plist.add(AstFactory.newAIdentifierPattern(result));
TypeCheckerErrors.report(3023, "Too many parameter patterns", node.getLocation(), node); TypeCheckerErrors.detail2("Type params", ptypes.size(), "Patterns", node.getParameterPatterns().size()); return null; } else if (node.getParameterPatterns().size() < ptypes.size()) TypeCheckerErrors.report(3024, "Too few parameter patterns", node.getLocation(), node); TypeCheckerErrors.detail2("Type params", ptypes.size(), "Patterns", node.getParameterPatterns().size()); return null; TypeCheckerErrors.report(3286, "Constructor cannot be 'async', 'static' or 'pure'", node.getLocation(), node); + node.getClassDefinition().getName().getName(), node.getLocation(), node); + node.getClassDefinition().getName().getName(), node.getLocation(), node); + node.getClassDefinition().getName().getName(), node.getLocation(), node); ABooleanBasicType expected = AstFactory.newABooleanBasicType(node.getLocation()); TypeCheckerErrors.report(3018, "Precondition returns unexpected type", node.getLocation(), node); TypeCheckerErrors.detail2("Actual", b, "Expected", expected); LexNameToken result = new LexNameToken(node.getName().getModule(), "RESULT", node.getLocation()); PPattern rp = AstFactory.newAIdentifierPattern(result); List<PDefinition> rdefs = question.assistantFactory.createPPatternAssistant().getDefinitions(rp, ((AOperationType) node.getType()).getResult(), NameScope.NAMESANDANYSTATE); post.setFunctional(true); PType b = node.getPostdef().getBody().apply(THIS, new TypeCheckInfo(question.assistantFactory, post, NameScope.NAMESANDANYSTATE)); ABooleanBasicType expected = AstFactory.newABooleanBasicType(node.getLocation());