@Override public ILexLocation defaultPType(PType node) throws AnalysisException { return node.getLocation(); }
public String getName(PType type) { return type.getLocation().getModule(); } }
public void addOneType(Set<PType> rtypes, PType add) { if (add instanceof AVoidReturnType) { rtypes.add(AstFactory.newAVoidType(add.getLocation())); } else if (!(add instanceof AVoidType)) { rtypes.add(add); } }
@Override public Boolean defaultInPType(PType node) throws AnalysisException { if (!isValidModule(node.getLocation())) { invalidNodes.add(node); return false; } return true; }
public void checkArgTypes(PType type, List<PType> ptypes, List<PType> atypes, TypeCheckInfo question) { if (ptypes.size() != atypes.size()) { TypeCheckerErrors.report(3211, "Expecting " + ptypes.size() + " arguments", type.getLocation(), type); } else { int i = 0; for (PType atype : atypes) { PType ptype = ptypes.get(i++); if (!question.assistantFactory.getTypeComparator().compatible(ptype, atype)) { TypeCheckerErrors.report(3212, "Unexpected type for argument " + i, atype.getLocation(), atype); TypeCheckerErrors.detail2("Expected", ptype, "Actual", atype); } } } }
public boolean addOne(PTypeSet rtypes, PType add) { if (add instanceof AVoidReturnType) { rtypes.add(AstFactory.newAVoidType(add.getLocation())); return true; } else if (!(add instanceof AVoidType)) { rtypes.add(add); return true; } else { rtypes.add(add); return false; } }
return AstFactory.newAUnionType(a.getLocation(), list);
public ValueList getAllValues(List<PType> linkedList, Context ctxt) throws AnalysisException { QuantifierList quantifiers = new QuantifierList(); int n = 0; for (PType t : linkedList) { LexNameToken name = new LexNameToken("#", String.valueOf(n), t.getLocation()); PPattern p = AstFactory.newAIdentifierPattern(name); Quantifier q = new Quantifier(p, af.createPTypeAssistant().getAllValues(t, ctxt)); quantifiers.add(q); } quantifiers.init(ctxt, true); ValueList results = new ValueList(); while (quantifiers.hasNext()) { NameValuePairList nvpl = quantifiers.next(); ValueList list = new ValueList(); for (NameValuePair nvp : nvpl) { list.add(nvp.value); } results.add(new TupleValue(list)); } return results; }
@Override public PType caseATypeMultipleBind(ATypeMultipleBind node, TypeCheckInfo question) throws AnalysisException { question.assistantFactory.createPPatternListAssistant().typeResolve(node.getPlist(), THIS, question); PType type = question.assistantFactory.createPTypeAssistant().typeResolve(node.getType(), null, THIS, question); PType ptype = question.assistantFactory.createPPatternListAssistant().getPossibleType(node.getPlist(), node.getLocation()); if (!question.assistantFactory.getTypeComparator().compatible(ptype, type)) { TypeCheckerErrors.report(3265, "At least one bind cannot match this type", type.getLocation(), type); TypeCheckerErrors.detail2("Binds", ptype, "Type", type); } node.setType(type); return type; }
String anon = Integer.toString(list.size() + 1); PType ftype = readType(); LexNameToken tagname = new LexNameToken(getCurrentModule(), anon, ftype.getLocation()); list.add(AstFactory.newAFieldField(tagname, anon, ftype, false)); reader.unpush();
} else if (t instanceof AIntNumericBasicType) t = AstFactory.newANatNumericBasicType(t.getLocation());
TypeCheckerErrors.report(3189, "Exported type does not match actual type", act.getLocation(), act); TypeCheckerErrors.detail2("Exported", type, "Actual", act);
throw new TypeCheckException("Unknown type: " + to, to.getLocation(), to); throw new TypeCheckException("Unknown type: " + from, from.getLocation(), from);
throw new TypeCheckException("Unknown type: " + sub, sub.getLocation(), sub); throw new TypeCheckException("Unknown type: " + sup, sup.getLocation(), sup);