public SatisfiabilityObligation(AImplicitOperationDefinition op, PDefinition stateDefinition, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_SATISFIABILITY, ctxt, op.getLocation(), af); /** * op: A * B ==> R [pre ...] post ... [pre_op(a, b, state) =>] exists r:R, state:Sigma & post_op(a, b, r, * state~, state) The state argument is either a Sigma(SL) or self(PP). */ PExp predExp = buildPredicate(op, stateDefinition); stitch = predExp; valuetree.setPredicate(ctxt.getPredWithContext(predExp)); }
public OperationPostConditionObligation(AImplicitOperationDefinition op, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_POST_CONDITION, ctxt, op.getLocation(), af); stitch = buildExp(op.getPrecondition(), op.getPostcondition().clone(), op.clone().getErrors()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public StateInvariantObligation(AImplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.STATE_INV, ctxt, def.getLocation(), af); assistantFactory = af; if (def.getClassDefinition() == null) { stitch = invDefs(def.getClassDefinition()); } else { stitch = invDefs(def.getStateDefinition()); } valuetree.setPredicate(ctxt.getPredWithContext(stitch)); // valuetree.setContext(ctxt.getContextNodeList()); }
private TypeCompatibilityObligation(AImplicitOperationDefinition def, PType actualResult, IPOContextStack ctxt, IPogAssistantFactory assistantFactory) throws AnalysisException { super(def, POType.TYPE_COMP, ctxt, def.getLocation(), assistantFactory); this.assistantFactory = assistantFactory; PExp result = null; if (def.getResult().getPattern() instanceof AIdentifierPattern) { AIdentifierPattern ip = (AIdentifierPattern) def.getResult().getPattern(); result = AstFactory.newAVariableExp(ip.getName()); } else { ATuplePattern tp = (ATuplePattern) def.getResult().getPattern(); List<PExp> args = new ArrayList<PExp>(); for (PPattern p : tp.getPlist()) { AIdentifierPattern ip = (AIdentifierPattern) p; args.add(AstFactory.newAVariableExp(ip.getName())); } result = AstFactory.newATupleExp(def.getLocation(), args); } stitch = oneType(false, result, ((AOperationType) def.getType()).getResult().clone(), actualResult.clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public ParameterPatternObligation(AImplicitOperationDefinition 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.createAImplicitOperationDefinitionAssistant().getListParamPatternList(def)), cloneListType(((AOperationType) def.getType()).getParameters()), ((AOperationType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public static AImplicitOperationDefinition newAImplicitOperationDefinition( ILexNameToken name, List<APatternListTypePair> parameterPatterns, APatternTypePair resultPattern, PStm body, ASpecificationStm spec) { AImplicitOperationDefinition result = new AImplicitOperationDefinition(); // Definition initialization initDefinition(result, Pass.DEFS, name.getLocation(), name, NameScope.GLOBAL); result.setParameterPatterns(parameterPatterns); result.setResult(resultPattern); result.setBody(body); result.setExternals(spec.getExternals()); result.setPrecondition(spec.getPrecondition()); result.setPostcondition(spec.getPostcondition()); result.setErrors(spec.getErrors()); result.setIsConstructor(false); List<PType> ptypes = new Vector<PType>(); for (APatternListTypePair ptp : parameterPatterns) { ptypes.addAll(getTypeList(ptp)); } AOperationType operationType = AstFactory.newAOperationType(result.getLocation(), ptypes, result.getResult() == null ? AstFactory.newAVoidType(name.getLocation()) : result.getResult().getType()); result.setType(operationType); return result; }
+ exname + " is not this type", node.getLocation(), node); TypeCheckerErrors.detail2("Declared", sdef.getType(), "ext type", clause.getType()); } else 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); pre.setFunctional(true); PType b = node.getPredef().getBody().apply(THIS, new TypeCheckInfo(question.assistantFactory, pre, NameScope.NAMESANDSTATE)); ABooleanBasicType expected = AstFactory.newABooleanBasicType(node.getLocation()); TypeCheckerErrors.report(3018, "Precondition returns unexpected type", node.getLocation(), node); TypeCheckerErrors.detail2("Actual", b, "Expected", expected); TypeCheckerErrors.report(3035, "Operation returns unexpected type", node.getLocation(), node); TypeCheckerErrors.detail2("Actual", node.getActualResult(), "Expected", ((AOperationType) node.getType()).getResult()); } else if (!node.getIsConstructor() TypeCheckerErrors.report(3312, "Void operation returns non-void value", node.getLocation(), node); TypeCheckerErrors.detail2("Actual", node.getActualResult(), "Expected", ((AOperationType) node.getType()).getResult()); } else if (!question.assistantFactory.createPTypeAssistant().isVoid(((AOperationType) node.getType()).getResult()) && question.assistantFactory.createPTypeAssistant().hasVoid(node.getActualResult())) TypeCheckerErrors.report(3313, "Operation returns void value", node.getLocation(), node); TypeCheckerErrors.detail2("Actual", node.getActualResult(), "Expected", ((AOperationType) node.getType()).getResult());