Package org.rascalmpl.interpreter.staticErrors

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType


    if (subscripts.length != 1) {
      throw new UnsupportedSubscriptArity(getType(), subscripts.length, ctx.getCurrentAST());
    }
    Result<IValue> key = (Result<IValue>) subscripts[0];
    if (!key.getType().isInteger()) {
      throw new UnexpectedType(TypeFactory.getInstance().integerType(), key.getType(), ctx.getCurrentAST());
    }
    if (getValue().length() == 0) {
      throw RuntimeExceptionFactory.emptyList(ctx.getCurrentAST(), ctx.getStackTrace());
    }
    IInteger index = ((IInteger)key.getValue());
View Full Code Here


    mp = pattern.getMatcher(ctx);
   
      mp.initMatch(result);

      if(!mp.mayMatch(subjectType, ctx.getCurrentEnvt())) {
        throw new UnexpectedType(mp.getType(ctx.getCurrentEnvt(), null), subjectType, ctx.getCurrentAST());
      }
     
      firstTime = true;
    }
View Full Code Here

       
       
        return false;
      }

      throw new UnexpectedType(tf.boolType(), result.getType(), expr);
    }
   
    return false;
  }
View Full Code Here

     
      // we use rhs value here, because the addition (for example) implicitly casts up to value,
      // in which case the error is lost. Since we know that the left hand side of the addition
      // is always the variable we are updating, the cause of the error must always be in the value
      // on the right hand side
      throw new UnexpectedType(oldValue.getType(), rhsValue.getType(), this.__getEval().getCurrentAST());
    }
    switch(this.__getOperator()){
      case Default:
      case IsDefined:
        return rhsValue;
View Full Code Here

    else if (!isPattern) {
      if (literal.getType().isBool()) {
        return ((IBool) literal).getValue();
      }
     
      throw new UnexpectedType(tf.boolType(), literal.getType(), ctx.getCurrentAST());
    }
   
   
    return false;
  }
View Full Code Here

              String name = Names.name(kwa.getName());

              if (kwFormals != null) {
                if (kwFormals.hasField(name)) {
                  if (!val.getType().isSubtypeOf(kwFormals.getFieldType(name))) {
                    throw new UnexpectedType(kwFormals.getFieldType(name), val.getType(), this);
                  }
                }
                else {
                  eval.getMonitor().warning("calling function with extra unknown keyword argument: " +  name, getLocation());
                }
View Full Code Here

    INumber iFrom = from.getValue();
    INumber iTo = to.getValue();
   
    // I still think it is ugly to do it here...
    if (!second.getType().isSubtypeOf(tf.numberType())) {
      throw new UnexpectedType(tf.numberType(), second.getType(), ctx.getCurrentAST());
    }
   
    INumber iSecond = (INumber) second.getValue();
    INumber diff = iSecond.subtract(iFrom);
   
View Full Code Here

    }

    @Override
    public IBooleanResult buildBacktracker(IEvaluatorContext __eval) {

      throw new UnexpectedType(TF.boolType(), this
          .interpret(__eval.getEvaluator()).getType(),
          this);

    }
View Full Code Here

    }

    @Override
    public IBooleanResult buildBacktracker(IEvaluatorContext __eval) {

      throw new UnexpectedType(TF.boolType(), this
          .interpret(__eval.getEvaluator()).getType(),
          this);

    }
View Full Code Here

    }

    @Override
    public IBooleanResult buildBacktracker(IEvaluatorContext __eval) {

      throw new UnexpectedType(TF.boolType(), this
          .interpret(__eval.getEvaluator()).getType(),
          this);

    }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.staticErrors.UnexpectedType

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.