Examples of UnexpectedType


Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

        }
       
        if (expected != null) {
          Type typ = tr.valueToType((IConstructor) expected);
          if (!result.getType().isSubtypeOf(typ)) {
            throw new UnexpectedType(typ, result.getType(), ctx.getCurrentAST());
          }
        }
        return result;
      }
    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

      }

      if (expected != null) {
        Type typ = tr.valueToType((IConstructor) expected);
        if (!result.getType().isSubtypeOf(typ)) {
          throw new UnexpectedType(typ, result.getType(), ctx.getCurrentAST());
        }
      }
      return result;
    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

    if(fact == null)
      throw RuntimeExceptionFactory.noSuchKey(vf.string(typeReifier.valueToType((IConstructor) key).toString() + ":" + name.toString()),
          ctx.getCurrentAST(), ctx.getStackTrace());
    else if(!fact.getType().isSubtypeOf(typeReifier.valueToType((IConstructor) key)))
      throw new UnexpectedType(typeReifier.valueToType((IConstructor) key), fact.getType(), ctx.getCurrentAST());
    else
      return fact;
  }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

    if(!(key instanceof IConstructor))
      throw RuntimeExceptionFactory.illegalArgument(key, ctx.getCurrentAST(), ctx.getStackTrace(), "key is not a reified type");

    Type keyType = typeReifier.valueToType((IConstructor) key);
    if(!value.getType().isSubtypeOf(keyType))
      throw new UnexpectedType(keyType, value.getType(), ctx.getCurrentAST());
    else
      transaction(tr).setFact(keyType, name, value);
  }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

      Result<IValue> result = fun.call(monitor, new Type[] {t.getType(), reifiedKey.getType(), name.getType()},
          new IValue[] {t, reifiedKey, name}, null);
      if(result.getValue() instanceof IBool)
        return ((IBool)result.getValue()).getValue();
      else
        throw new UnexpectedType(TypeFactory.getInstance().boolType(), result.getType(), ctx.getCurrentAST());
       
    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

    try {
      int index = getType().getFieldIndex(name);
      Type type = getType().getFieldType(index);
      if(!type.isSubtypeOf(repl.getType())){
        throw new UnexpectedType(type, repl.getType(), ctx.getCurrentAST());
      }
      return makeResult(getType(), getValue().set(index, repl.getValue()), ctx);
    } catch (UndeclaredFieldException e) {
      throw new UndeclaredField(name, getType(), ctx.getCurrentAST());
    }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

    if (getType() != getTypeFactory().nodeType()) {
      if (getType() != getTypeFactory().nodeType() && annoType == null) {
        throw new UndeclaredAnnotation(annoName, getType(), ctx.getCurrentAST());
      }
      if (!anno.getType().isSubtypeOf(annoType)){
        throw new UnexpectedType(annoType, anno.getType(), ctx.getCurrentAST());
      }
    }

    IValue annotatedBase = ((INode)getValue()).asAnnotatable().setAnnotation(annoName, anno.getValue());
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

 
  @SuppressWarnings("unchecked")
  private int getInt(Result<?> x){
    Result<IValue> key = (Result<IValue>) x;
    if (!key.getType().isInteger()) {
      throw new UnexpectedType(TypeFactory.getInstance().integerType(), key.getType(), ctx.getCurrentAST());
    }
    return ((IInteger)key.getValue()).intValue();
  }
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

      Result<IValue> symbol = getSymbol().interpret(__eval);
      Result<IValue> declarations = getDefinitions().interpret(__eval);
     
      if (!symbol.getType().isSubtypeOf(Factory.Symbol)) {
        throw new UnexpectedType(Factory.Symbol, symbol.getType(), getSymbol());
      }
     
      if (!declarations.getType().isSubtypeOf(defType)) {
        throw new UnexpectedType(defType, declarations.getType(), getSymbol());
      }
     
      java.util.Map<Type,Type> bindings = new HashMap<Type,Type>();
      bindings.put(Factory.TypeParam, new TypeReifier(VF).symbolToType((IConstructor) symbol.getValue(), (IMap) declarations.getValue()));
     
View Full Code Here

Examples of org.rascalmpl.interpreter.staticErrors.UnexpectedType

 
  @Override
  public Result<IValue> call(Type[] argTypes, IValue[] actuals, Map<String, IValue> keyArgValues) {
    if (actuals.length >= 2) {
      if (!argTypes[0].isSubtypeOf(getTypeFactory().integerType())) {
        throw new UnexpectedType(getTypeFactory().integerType(), argTypes[0], ctx.getCurrentAST());
      }
      if (!argTypes[1].isSubtypeOf(getTypeFactory().integerType())) {
        throw new UnexpectedType(getTypeFactory().integerType(), argTypes[1], ctx.getCurrentAST());
      }
     
      if (actuals.length == 4) {
        if (!argTypes[2].isSubtypeOf(intTuple)) {
          throw new UnexpectedType(intTuple, argTypes[2], ctx.getCurrentAST());
        }
        if (!argTypes[3].isSubtypeOf(intTuple)) {
          throw new UnexpectedType(intTuple, argTypes[3], ctx.getCurrentAST());
        }
      }
      else if (actuals.length != 2) {
        throw new SyntaxError("location constructor", ctx.getCurrentAST().getLocation());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.