Package edu.mit.csail.sdg.alloy4

Examples of edu.mit.csail.sdg.alloy4.ErrorType


         if (parent==SEQIDX) throw new ErrorSyntax(pos, "sig "+label+" cannot extend the builtin \"seq/Int\" signature");
         if (parent==STRING) throw new ErrorSyntax(pos, "sig "+label+" cannot extend the builtin \"String\" signature");
         if (parent==NONE)   throw new ErrorSyntax(pos, "sig "+label+" cannot extend the builtin \"none\" signature");
         if (parent==null) parent=UNIV; else if (parent!=UNIV) parent.children.add(this);
         this.parent = parent;
         if (isEnum!=null && parent!=UNIV) throw new ErrorType(pos, "sig "+label+" is not a toplevel sig, so it cannot be an enum.");
         for( ; parent!=null ; parent=parent.parent) if (parent.isEnum!=null) {
            if (parent!=this.parent) throw new ErrorSyntax(pos, "sig "+label+" cannot extend a signature which is an atom in an enum.");
            if (isOne==null) throw new ErrorSyntax(pos, "sig "+label+" is an atom in an enum, so it must have the \"one\" multiplicity.");
         }
      }
View Full Code Here


       * @throws ErrorSyntax if the signature has two or more multiplicities
       * @throws ErrorType if parents only contains NONE
       */
      public SubsetSig(String label, Collection<Sig> parents, Attr... attributes) throws Err {
         super(getType(label,parents), label, Util.append(attributes, Attr.SUBSET));
         if (isEnum!=null) throw new ErrorType(pos, "Subset signature cannot be an enum.");
         boolean exact = false;
         for(Attr a: attributes) if (a!=null && a.type==AttrType.EXACT) exact = true;
         this.exact = exact;
         TempList<Sig> temp = new TempList<Sig>(parents==null ? 1 : parents.size());
         if (parents==null || parents.size()==0) {
            temp.add(UNIV);
         } else {
            for(Sig parent:parents) {
               if (!Version.experimental) {
                  if (parent==SIGINT) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"Int\" signature");
                  if (parent==SEQIDX) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"seq/Int\" signature");
                  if (parent==STRING) throw new ErrorSyntax(pos, "sig "+label+" cannot be a subset of the builtin \"String\" signature");
               }
               if (parent==Sig.UNIV) {temp.clear(); temp.add(UNIV); break;}
               if (parent!=Sig.NONE && !temp.contains(parent)) temp.add(parent);
            }
         }
         if (temp.size()==0) throw new ErrorType(pos, "Sig "+label+" must have at least one non-empty parent.");
         this.parents = temp.makeConst();
      }
View Full Code Here

         super(pos, label, sig.type.product(bound.type));
         this.defined = bound.mult() == ExprUnary.Op.EXACTLYOF;
         if (sig.builtin) throw new ErrorSyntax(pos, "Builtin sig \""+sig+"\" cannot have fields.");
         if (!bound.errors.isEmpty()) throw bound.errors.pick();
         if (!this.defined && bound.hasCall()) throw new ErrorSyntax(pos, "Field \""+label+"\" declaration cannot contain a function or predicate call.");
         if (bound.type.arity()>0 && bound.type.hasNoTuple()) throw new ErrorType(pos, "Cannot bind field "+label+" to the empty set or empty relation.");
         this.isPrivate = (isPrivate!=null ? isPrivate : sig.isPrivate);
         this.isMeta = (isMeta!=null ? isMeta : sig.isMeta);
         this.sig = sig;
      }
View Full Code Here

            StringBuilder sb=new StringBuilder("This cannot be a legal relational join where\nleft hand side is ");
            left.toString(sb,-1);
            sb.append(" (type = ").append(left.type).append(")\nright hand side is ");
            right.toString(sb,-1);
            sb.append(" (type = ").append(right.type).append(")\n");
            errors = errors.make(new ErrorType(pos, sb.toString()));
        }
        return new ExprBadJoin(pos, closingBracket, left, right, errors);
    }
View Full Code Here

               Macro mac = m.macros.get(name);
               if (mac==null) continue;
               if (match!=null) ambiguous=true; else match=mac;
               sb.append("\n").append(m.path.length()==0 ? "this" : m.path).append("/").append(name);
            }
            if (ambiguous) return new ExprBad(pos, name, new ErrorType(pos, "There are multiple macros with the same name:"+sb));
         }
         if (match==null) match = rootmodule.globals.get(name);
         if (match!=null) {
            if (match instanceof Macro) return ((Macro)match).changePos(pos);
            match = ExprUnary.Op.NOOP.make(pos, match);
View Full Code Here

        }
    }

    static ErrorType rethrow(CapacityExceededException ex) {
        IntVector vec = ex.dims();
        return new ErrorType(
          "Translation capacity exceeded.\n"
          + "In this scope, universe contains " + vec.get(0) + " atoms\n"
          + "and relations of arity " + vec.size() + " cannot be represented.\n"
          + "Visit http://alloy.mit.edu/ for advice on refactoring.");
    }
View Full Code Here

            return sol;
        } catch(CapacityExceededException ex) {
            throw rethrow(ex);
        } catch(HigherOrderDeclException ex) {
            Pos p = tr!=null ? tr.frame.kv2typepos(ex.decl().variable()).b : Pos.UNKNOWN;
            throw new ErrorType(p, "Analysis cannot be performed since it requires higher-order quantification that could not be skolemized.");
        }
    }
View Full Code Here

            throw new ErrorFatal("The required JNI library cannot be found: "+ex.toString().trim());
        } catch(CapacityExceededException ex) {
            throw rethrow(ex);
        } catch(HigherOrderDeclException ex) {
            Pos p = tr!=null ? tr.frame.kv2typepos(ex.decl().variable()).b : Pos.UNKNOWN;
            throw new ErrorType(p, "Analysis cannot be performed since it requires higher-order quantification that could not be skolemized.");
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

            throw new ErrorFatal("The required JNI library cannot be found: "+ex.toString().trim());
        } catch(CapacityExceededException ex) {
            throw rethrow(ex);
        } catch(HigherOrderDeclException ex) {
            Pos p = tr!=null ? tr.frame.kv2typepos(ex.decl().variable()).b : Pos.UNKNOWN;
            throw new ErrorType(p, "Analysis cannot be performed since it requires higher-order quantification that could not be skolemized.");
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

        } catch(UnsatisfiedLinkError ex) {
            throw new ErrorFatal("The required JNI library cannot be found: "+ex.toString().trim());
        } catch(CapacityExceededException ex) {
            throw rethrow(ex);
        } catch(HigherOrderDeclException ex) {
            throw new ErrorType("Analysis cannot be performed since it requires higher-order quantification that could not be skolemized.");
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex;
            throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
        if ((ans instanceof IntExpression) || (ans instanceof Formula) || (ans instanceof Expression)) return ans;
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4.ErrorType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.