Package com.sun.tools.javac.code

Examples of com.sun.tools.javac.code.Type$ErrorType


     * @throws ErrorType if is_int is true
     * @throws ErrorType if is_bool is true
     */
    public Expr toExpr() throws Err {
        int arity = arity();
        if (is_int || is_bool || arity<1) throw new ErrorType("Cannot convert this type into a bounding expression.");
        Expr ans = null;
        for(ProductType pt:this) {
            Expr pro = null;
            for(int i=0; i<arity; i++) if (pro==null) pro=pt.types[i]; else pro=pro.product(pt.types[i]);
            if (ans==null) ans=pro; else ans = ans.plus(pro);
View Full Code Here


                if (n==0) break; else n--;
                sb.append("  ");
                v.toString(sb, -1);
                sb.append(" (type = ").append(v.type).append(")\n");
            }
            errors = errors.make(new ErrorType(pos, sb.toString()));
        }
        return new ExprBadCall(pos, closingBracket, ambiguous, fun, args, errors, extraPenalty, weight);
    }
View Full Code Here

                }
                if (Type.INT2SIGINT) {
                    if (a.is_int && b.hasArity(1)) { left=left.cast2sigint(); continue; }
                    if (b.is_int && a.hasArity(1)) { right=right.cast2sigint(); continue; }
                }
                errs = errs.make(new ErrorType(cond.span().merge(right.span()).merge(left.span()),
                    "The then-clause and the else-clause must match.\nThe then-clause has type: "
                    + a + "\nand the else-clause has type: " + b));
            }
            break;
        }
View Full Code Here

            errs = errs.make(new ErrorSyntax(sub.span(), "Multiplicity expression not allowed here."));
        if (errs.size()==0 && var.type!=expr.type)
            if (var.type.is_int!=expr.type.is_int
             || var.type.is_bool!=expr.type.is_bool
             || var.type.arity()!=expr.type.arity())
                errs = errs.make(new ErrorType(var.span(), "This variable has type "+var.type+" but is bound to a value of type "+expr.type));
        return new ExprLet(pos, var, expr, sub, errs);
    }
View Full Code Here

     * @param warnings - the list that will receive any warning we generate; can be null if we wish to ignore warnings
     */
    Expr instantiate(Context cx, List<ErrorWarning> warnings) throws Err {
        if (cx.unrolls<=0) {
            Pos p = span();
            return new ExprBad(p, toString(), new ErrorType(p, "Macro substitution too deep; possibly indicating an infinite recursion."));
        }
        if (params.size() != args.size()) return this;
        Context cx2 = new Context(realModule, warnings, cx.unrolls-1);
        for(int n=params.size(), i=0; i<n; i++) {
            Expr tmp = args.get(i);
View Full Code Here

   /** Add a new per-atom fact; this expression is allowed to refer to this.decl.get() */
   public void addFact(Expr fact) throws Err {
      if (fact.ambiguous) fact = fact.resolve_as_formula(null);
      if (!fact.errors.isEmpty()) throw fact.errors.pick();
      if (!fact.type.is_bool) throw new ErrorType(fact.span(), "This expression must be a formula; instead its type is "+fact.type);
      facts.add(fact);
   }
View Full Code Here

         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

TOP

Related Classes of com.sun.tools.javac.code.Type$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.