@Override public IProofObligationList caseAMapInverseUnaryExp( AMapInverseUnaryExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = node.getExp().apply(mainVisitor, question); if (!node.getMapType().getEmpty()) { obligations.add(new org.overture.pog.obligation.MapInverseObligation(node, question, aF)); } return obligations; }
@Override public List<PDefinition> caseAMapPattern(AMapPattern pattern, NewQuestion question) throws AnalysisException { List<PDefinition> defs = new Vector<PDefinition>(); if (!af.createPTypeAssistant().isMap(question.ptype)) { TypeCheckerErrors.report(3314, "Map pattern is not matched against map type", pattern.getLocation(), pattern); TypeCheckerErrors.detail("Actual type", question.ptype); } else { SMapType map = af.createPTypeAssistant().getMap(question.ptype); if (!map.getEmpty()) { for (AMapletPatternMaplet p : pattern.getMaplets()) { defs.addAll(getDefinitions(p, map, question.scope)); // defs.addAll(p.apply(THIS, question)); } } } return defs; }
@Override public void defaultSMapType(SMapType type) throws AnalysisException { if (!type.getResolved()) { return; } else { type.setResolved(false); } if (!type.getEmpty()) { type.getFrom().apply(THIS); type.getTo().apply(THIS); } }
public PType mapApply(AApplyExp node, boolean isSimple, SMapType map, TypeCheckInfo question) { if (map.getEmpty()) { TypeCheckerErrors.concern(isSimple, 3267, "Empty map cannot be applied", node.getLocation(), node); } if (node.getArgs().size() != 1) { TypeCheckerErrors.concern(isSimple, 3057, "Map application must have one argument", node.getLocation(), node); } else { PType argtype = node.getArgtypes().get(0); if (!question.assistantFactory.getTypeComparator().compatible(map.getFrom(), argtype)) { TypeCheckerErrors.concern(isSimple, 3058, "Map application argument is incompatible type", node.getLocation(), node); TypeCheckerErrors.detail2(isSimple, "Map domain", map.getFrom(), "Argument", argtype); } } return map.getTo(); }
@Override public PType defaultSMapType(SMapType type, Newquestion question) throws AnalysisException { if (type.getResolved()) { return type; } else { type.setResolved(true); } try { if (!type.getEmpty()) { type.setFrom(af.createPTypeAssistant().typeResolve(type.getFrom(), question.root, question.rootVisitor, question.question)); type.setTo(af.createPTypeAssistant().typeResolve(type.getTo(), question.root, question.rootVisitor, question.question)); } return type; } catch (TypeCheckException e) { type.apply(af.getTypeUnresolver()); throw e; } }