Does the variable both have the given type and
        have a variable value we can use?
331151
def has_value_of_type(self, var_type):
        
        if self.has_value() and self.has_type(var_type):
            return True
        return False
91866
private VarSymbol makeSyntheticVar(long flags, String name, Type type, Symbol owner) {
        return makeSyntheticVar(flags, names.fromString(name), type, owner);
    }
132834
private boolean isObjectTypeWithNonStringifiableKey(JSType type) {
    if (!type.isTemplatizedType()) {
      return false;
    }
    TemplatizedType templatizedType = type.toMaybeTemplatizedType();
    if (templatizedType.getReferencedType().isNativeObjectType()
        && templatizedType.getTemplateTypes().size() > 1) {
      return !isReasonableObjectPropertyKey(templatizedType.getTemplateTypes().get(0));
    } else {
      return false;
    }
  }
1249503
public Type resolveType(TypeVariable<?> variable) {
        Type resolvedType = this.resolvedTypeVariables.get(variable);
        if (resolvedType == null) {
            return variable; // we are not able to resolve
        }
        return resolvedType;
    }
1066701
public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
        if (type.isCustomVariable()) {
            return true;
        }
        if (customVariables != null && customVariables.contains(name)) {
            return true;
        }
        if (customChoiceStrategy != null
                && customChoiceStrategy.getVariableNames() != null
                && customChoiceStrategy.getVariableNames().contains(name)) {
            return true;
        }
        return false;
    }
554296
static Object coerceTypeImpl(Class<?> type, Object value)
    {
        if (value != null && value.getClass() == type) {
            return value;
        }

        switch (getJSTypeCode(value)) {

        case JSTYPE_NULL:
            // raise error if type.isPrimitive()
            if (type.isPrimitive()) {
                reportConversionError(value, type);
            }
            return null;

        case JSTYPE_UNDEFINED:
            if (type == ScriptRuntime.StringClass ||
                type == ScriptRuntime.ObjectClass) {
                return "undefined";
            }
            reportConversionError("undefined", type);
            break;

        case JSTYPE_BOOLEAN:
            // Under LC3, only JS Booleans can be coerced into a Boolean value
            if (type == Boolean.TYPE ||
                type == ScriptRuntime.BooleanClass ||
                type == ScriptRuntime.ObjectClass) {
                return value;
            }
            else if (type == ScriptRuntime.StringClass) {
                return value.toString();
            }
            else {
                reportConversionError(value, type);
            }
            break;

        case JSTYPE_NUMBER:
            if (type == ScriptRuntime.StringClass) {
                return ScriptRuntime.toString(value);
            }
            else if (type == ScriptRuntime.ObjectClass) {
                Context context = Context.getCurrentContext();
                if(context.hasFeature(Context.FEATURE_INTEGER_WITHOUT_DECIMAL_PLACE)) {
                    //to process numbers like 2.0 as 2 without decimal place
                    long roundedValue = Math.round(toDouble(value));
                    if(roundedValue == toDouble(value)) {
                        return coerceToNumber(Long.TYPE, value);
                    }
                }
                return coerceToNumber(Double.TYPE, value);
            }
            else if ((type.isPrimitive() && type != Boolean.TYPE) ||
                     ScriptRuntime.NumberClass.isAssignableFrom(type)) {
                return coerceToNumber(type, value);
            }
            else {
                reportConversionError(value, type);
            }
            break;

        case JSTYPE_STRING:
            if (type == ScriptRuntime.StringClass || type.isInstance(value)) {
                return value.toString();
            }
            else if (type == Character.TYPE
                     || type == ScriptRuntime.CharacterClass)
            {
                // Special case for converting a single char string to a
                // character
                // Placed here because it applies *only* to JS strings,
                // not other JS objects converted to strings
                if (((CharSequence)value).length() == 1) {
                    return Character.valueOf(((CharSequence)value).charAt(0));
                }
                return coerceToNumber(type, value);
            }
            else if ((type.isPrimitive() && type != Boolean.TYPE)
                     || ScriptRuntime.NumberClass.isAssignableFrom(type))
            {
                return coerceToNumber(type, value);
            }
            else {
                reportConversionError(value, type);
            }
            break;

        case JSTYPE_JAVA_CLASS:
            if (value instanceof Wrapper) {
                value = ((Wrapper)value).unwrap();
            }

            if (type == ScriptRuntime.ClassClass ||
                type == ScriptRuntime.ObjectClass) {
                return value;
            }
            else if (type == ScriptRuntime.StringClass) {
                return value.toString();
            }
            else {
                reportConversionError(value, type);
            }
            break;

        case JSTYPE_JAVA_OBJECT:
        case JSTYPE_JAVA_ARRAY:
            if (value instanceof Wrapper) {
              value = ((Wrapper)value).unwrap();
            }
            if (type.isPrimitive()) {
                if (type == Boolean.TYPE) {
                    reportConversionError(value, type);
                }
                return coerceToNumber(type, value);
            }
          if (type == ScriptRuntime.StringClass) {
                return value.toString();
            }
            if (type.isInstance(value)) {
                return value;
            }
            reportConversionError(value, type);
            break;

        case JSTYPE_OBJECT:
            if (type == ScriptRuntime.StringClass) {
                return ScriptRuntime.toString(value);
            }
            else if (type.isPrimitive()) {
                if (type == Boolean.TYPE) {
                    reportConversionError(value, type);
                }
                return coerceToNumber(type, value);
            }
            else if (type.isInstance(value)) {
                return value;
            }
            else if (type == ScriptRuntime.DateClass
                     && value instanceof NativeDate)
            {
                double time = ((NativeDate)value).getJSTimeValue();
                // XXX: This will replace NaN by 0
                return new Date((long)time);
            }
            else if (type.isArray() && value instanceof NativeArray) {
                // Make a new java array, and coerce the JS array components
                // to the target (component) type.
                NativeArray array = (NativeArray) value;
                long length = array.getLength();
                Class<?> arrayType = type.getComponentType();
                Object Result = Array.newInstance(arrayType, (int)length);
                for (int i = 0 ; i < length ; ++i) {
                    try  {
                        Array.set(Result, i, coerceTypeImpl(
                                arrayType, array.get(i, array)));
                    }
                    catch (EvaluatorException ee) {
                        reportConversionError(value, type);
                    }
                }

                return Result;
            }
            else if (value instanceof Wrapper) {
                value = ((Wrapper)value).unwrap();
                if (type.isInstance(value))
                    return value;
                reportConversionError(value, type);
            }
            else if (type.isInterface() && (value instanceof NativeObject
                    || value instanceof NativeFunction)) {
                // Try to use function/object as implementation of Java interface.
                return createInterfaceAdapter(type, (ScriptableObject) value);
            } else {
                reportConversionError(value, type);
            }
            break;
        }

        return value;
    }
641426
function allowedVariableUsage(
  schema: GraphQLSchema,
  varType: GraphQLType,
  varDefaultValue: ?ValueNode,
  locationType: GraphQLType,
  locationDefaultValue: ?mixed,
): boolean {
  if (isNonNullType(locationType) && !isNonNullType(varType)) {
    const hasNonNullVariableDefaultValue =
      varDefaultValue && varDefaultValue.kind !== Kind.NULL;
    const hasLocationDefaultValue = locationDefaultValue !== undefined;
    if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) {
      return false;
    }
    const nullableLocationType = locationType.ofType;
    return isTypeSubTypeOf(schema, varType, nullableLocationType);
  }
  return isTypeSubTypeOf(schema, varType, locationType);
}
405548
@SuppressWarnings("unchecked")
  public <T extends TypedValue> T getVariableLocalTyped(String variableName) {
    TypedValue variable = associationManager.getVariableLocal(variableName);
    return variable != null ? (T) variable : null;
  }
660377
def variables(self, value):
        

        if value is not None:
            assert type(value) is dict, "'{0}' attribute: '{1}' type is not 'dict'!".format("variables", value)
            for key, element in value.iteritems():
                assert type(key) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                    "variables", key)
                assert type(element) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                    "variables", element)
        self.__variables = value
434169
@SuppressWarnings("unchecked")
    public <T extends WindupVertexFrame> Iterable<T> findVariableOfType(Class<T> type)
    {
        for (Map<String, Iterable<? extends WindupVertexFrame>> topOfStack : deque)
        {
            for (Iterable<? extends WindupVertexFrame> frames : topOfStack.values())
            {
                boolean empty = true;
                for (WindupVertexFrame frame : frames)
                {
                    if (!type.isAssignableFrom(frame.getClass()))
                    {
                        break;
                    }
                    else
                    {
                        empty = false;
                    }
                }
                // now we know all the frames are of the chosen type
                if (!empty)
                    return (Iterable<T>) frames;
            }
        }
        return null;
    }
788842
private static void buildTypeVariableMap(ParameterizedType type,
                                             Map<TypeVariable<?>, Type> typeVariableMap) {
        if (type.getRawType() instanceof Class) {
            TypeVariable<?>[] typeVariables = ((Class<?>) type.getRawType()).getTypeParameters();
            Type[] typeArguments = type.getActualTypeArguments();

            for (int i = 0; i < typeArguments.length; i++) {
                TypeVariable<?> variable = typeVariables[i];
                Type typeArgument = typeArguments[i];

                if (typeArgument instanceof Class) {
                    typeVariableMap.put(variable, typeArgument);
                } else if (typeArgument instanceof GenericArrayType) {
                    typeVariableMap.put(variable, typeArgument);
                } else if (typeArgument instanceof ParameterizedType) {
                    typeVariableMap.put(variable, typeArgument);
                } else if (typeArgument instanceof TypeVariable) {
                    TypeVariable<?> typeVariableArgument = (TypeVariable<?>) typeArgument;
                    Type resolvedType = typeVariableMap.get(typeVariableArgument);
                    if (resolvedType == null)
                        resolvedType = resolveBound(typeVariableArgument);
                    typeVariableMap.put(variable, resolvedType);
                }
            }
        }
    }
180068
public static boolean isTypeIncludedIn(TypeName value, Type... types) {
		for (Type item : types) {
			if (value.equals(typeName(item))) {
				return true;
			}
		}

		return false;
	}
1062054
def set_variable_type(index, type)
      case type
      when :continuous
        Cbc.Cbc_setContinuous @ptr, index
      when :integer, :binary
        Cbc.Cbc_setInteger @ptr, index
      else
        fail :type
      end
    end
89405
public static <T extends TypeDefinition> ElementMatcher.Junction<T> isVariable(ElementMatcher<? super NamedElement> matcher) {
        return new TypeSortMatcher<T>(anyOf(TypeDefinition.Sort.VARIABLE, TypeDefinition.Sort.VARIABLE_SYMBOLIC)).and(matcher);
    }
323459
private Object getEnumValue(Class<?> type, Object value) {
        Object[] enumValues = type.getEnumConstants();
        for (Object enumValue : enumValues) {
            if (enumValue.toString().equals(value.toString())) {
                value = enumValue;
                break;
            }
        }
        return value;
    }
1239500
def set_variable_type(index, type)
      case type
      when :integer
        ret = LPSolve.set_int @ptr, index, 1
      when :binary
        ret = LPSolve.set_binary @ptr, index, 1
      when :continuous
        ret = LPSolve.set_int @ptr, index, 0
      else
        fail type
      end

      fail if ret != 1
    end
815799
void resolveTypeVariable(SQLiteModelMethod value) {
		// before proceed, we need to resolve typeVariables
		for (Pair<String, TypeName> item : value.getParameters()) {
			item.value1 = typeVariableResolver.resolve(item.value1);
		}

		value.setReturnClass(typeVariableResolver.resolve(value.getReturnClass()));

	}