Complete an value of an abstract type by determining the runtime type of that value, then completing based
    on that type.
163497
def complete_abstract_value(
    exe_context,  # type: ExecutionContext
    return_type,  # type: Union[GraphQLInterfaceType, GraphQLUnionType]
    field_asts,  # type: List[Field]
    info,  # type: ResolveInfo
    path,  # type: List[Union[int, str]]
    result,  # type: Any
):
    # type: (...) -> Dict[str, Any]
    
    runtime_type = None  # type: Union[str, GraphQLObjectType, None]

    # Field type must be Object, Interface or Union and expect sub-selections.
    if isinstance(return_type, (GraphQLInterfaceType, GraphQLUnionType)):
        if return_type.resolve_type:
            runtime_type = return_type.resolve_type(result, info)
        else:
            runtime_type = get_default_resolve_type_fn(result, info, return_type)

    if isinstance(runtime_type, string_types):
        runtime_type = info.schema.get_type(runtime_type)  # type: ignore

    if not isinstance(runtime_type, GraphQLObjectType):
        raise GraphQLError(
            (
                "Abstract type {} must resolve to an Object type at runtime "
                + 'for field {}.{} with value "{}", received "{}".'
            ).format(
                return_type, info.parent_type, info.field_name, result, runtime_type
            ),
            field_asts,
        )

    if not exe_context.schema.is_possible_type(return_type, runtime_type):
        raise GraphQLError(
            u'Runtime Object type "{}" is not a possible type for "{}".'.format(
                runtime_type, return_type
            ),
            field_asts,
        )

    return complete_object_value(
        exe_context, runtime_type, field_asts, info, path, result
    )
805905
private static <T> SimonType getValue(Class<? extends T> type, SimonTypeMatcher<T> typeMatcher) {
		SimonType simonType = SIMON_TYPE_CACHE.get(type);
		if (simonType == null) {
			for (SimonType lSimonType : SimonType.values()) {
				if (typeMatcher.matches(type, lSimonType)) {
					simonType = lSimonType;
					if (!Proxy.isProxyClass(type)) {
						SIMON_TYPE_CACHE.put(type, simonType);
					}
					break;
				}
			}
		}
		return simonType;
	}
229426
public DiscriminatorJdbcSubBuilder when(String value, Type type) {
        return when(new DiscriminatorPredicate(value), type);
    }
517720
void writeSimple(Class<?> declaredType, Object value) throws IOException {
        // simple types have no need to write a type object
        Class<?> realType = value.getClass();
        if (realType == Integer.class) {
            output.writeInt(((Integer) value).intValue());
            return;
        } else if (realType == Double.class) {
            output.writeDouble(((Double) value).doubleValue());
            return;
        } else if (realType == Float.class) {
            output.writeFloat(((Float) value).floatValue());
            return;
        } else if (realType == Boolean.class) {
            output.writeBoolean(((Boolean) value).booleanValue());
            return;
        }

        // handle no declared type and subclasses
        Class<?> effectiveType = getAndSerializeEffectiveTypeIfRequired(value, declaredType);

        // long/short/byte only processed now to ensure that a distinction can be made between Integer and Long
        if (realType == Long.class) {
            output.writeLong(((Long) value).longValue());
            return;
        } else if (realType == Short.class) {
            output.writeInt(((Short) value).shortValue());
            return;
        } else if (realType == Byte.class) {
            output.writeInt(((Byte) value).byteValue());
            return;
        } else if (realType == byte[].class) {
            output.writeBytes((byte[]) value);
            return;
        }

        // write as a string
        try {
            writeObjectAsString(value, effectiveType);
        } catch (RuntimeException ex) {
            throw new IllegalArgumentException("Unable to convert type " + effectiveType.getName() + " declared as " + declaredType.getName(), ex);
        }
    }
1301843
private boolean verifyTypes()
    {
        SuccessAndResult<ThriftType> output = topologicalSort(thriftTypes, new Predicate<ThriftType>()
        {
            @Override
            public boolean apply(@Nullable ThriftType t)
            {
                ThriftProtocolType proto = checkNotNull(t).getProtocolType();
                if (proto == ThriftProtocolType.ENUM || proto == ThriftProtocolType.STRUCT) {
                    return verifyStruct(t, true);
                } else {
                    Preconditions.checkState(false, "Top-level non-enum and non-struct?");
                    return false;   // silence compiler
                }
            }
        });
        if (output.success) {
            thriftTypes = output.result;
            return true;
        } else {
            for (ThriftType t: output.result) {
                // we know it's gonna fail, we just want the precise error message
                verifyStruct(t, false);
            }
            return false;
        }
    }
1299275
private void _processValue (@Nonnull final CValuePropertyInfo aProperty, final ClassOutline aClassOutline)
  {
    final String sPropertyName = aProperty.getName (false);

    final XSComponent aDefinition = aProperty.getSchemaComponent ();
    if (aDefinition instanceof RestrictionSimpleTypeImpl)
    {
      final RestrictionSimpleTypeImpl aParticle = (RestrictionSimpleTypeImpl) aDefinition;
      final XSSimpleType aSimpleType = aParticle.asSimpleType ();
      final JFieldVar aFieldVar = aClassOutline.implClass.fields ().get (sPropertyName);

      // if (particle.isRequired()) {
      // if (!hasAnnotation(var, NotNull.class)) {
      // if (notNullAnnotations) {
      // var.annotate(NotNull.class);
      // }
      // }
      // }

      _processType (aSimpleType, aFieldVar);
    }
  }
53790
@Trivial // traced by caller
    static <U> CompletionStage<U> completedStage(U value, Executor executor) {
        if (JAVA8) {
            return new ManagedCompletionStage<U>(CompletableFuture.completedFuture(value), executor, null);
        } else {
            ManagedCompletableFuture<U> stage = new ManagedCompletionStage<U>(executor);
            stage.super_complete(value);
            return stage;
        }
    }
1364323
private List<AbstractPropertyInfo> processAbstractProperties(TypeElement type) {
        List<AbstractPropertyInfo> abstractProperties = new ArrayList<>();

        ElementFilter.methodsIn(type.getEnclosedElements()).stream()
                .filter(method -> method.getModifiers().contains(Modifier.ABSTRACT))
                .forEach(method -> {

                    // verify method
                    if (method.getReturnType().getKind() == TypeKind.VOID) {
                        abortWithError(method, "Abstract classes in a @%s class must not return void",
                                Templated.class.getSimpleName());
                    }
                    if (!method.getParameters().isEmpty()) {
                        abortWithError(method, "Abstract classes in a @%s class must not have parameters",
                                Templated.class.getSimpleName());
                    }

                    String typeName = TypeSimplifier.simpleTypeName(method.getReturnType());
                    String methodName = method.getSimpleName().toString();
                    String fieldName = (isGetter(method)) ? nameWithoutPrefix(methodName) : methodName;
                    String modifier = getModifier(method);
                    abstractProperties.add(new AbstractPropertyInfo(typeName, fieldName, methodName, modifier));
                });

        return abstractProperties;
    }
1039574
public boolean complete(Number value) {
		return root.complete(new Tree((Tree) null, null, value));
	}
1232409
final TypeCheck makeTypeCheck(AbstractCompiler compiler) {
    return new TypeCheck(
            compiler,
            compiler.getReverseAbstractInterpreter(),
            compiler.getTypeRegistry(),
            topScope,
            typedScopeCreator)
        .reportUnknownTypes(options.enables(DiagnosticGroup.forType(TypeCheck.UNKNOWN_EXPR_TYPE)))
        .reportMissingProperties(
            !options.disables(DiagnosticGroup.forType(TypeCheck.INEXISTENT_PROPERTY)));
  }
713719
def _ValidateValue(value, type_check):
  """"""
  if inspect.isclass(type_check):
    return isinstance(value, type_check)
  if isinstance(type_check, tuple):
    return _ValidateTuple(value, type_check)
  elif callable(type_check):
    return type_check(value)
  else:
    raise TypeError("Invalid type check '%s'" % repr(type_check))
1215530
public static BuildableType.Builder from(BuildableType value) {
    if (value instanceof Rebuildable) {
      return ((Rebuildable) value).toBuilder();
    } else {
      return new BuildableType.Builder().mergeFrom(value);
    }
  }
1199507
private Object invokeProcessorsFor(Object value, ResolvableType type) {

		Object currentValue = value;

		// Process actual value
		for (RepresentationModelProcessorInvoker.ProcessorWrapper wrapper : this.processors) {
			if (wrapper.supports(type, currentValue)) {
				currentValue = wrapper.invokeProcessor(currentValue);
			}
		}

		return currentValue;
	}
735651
def visitValueType(self, ctx: jsgParser.ValueTypeContext):
        
        if ctx.idref():
            self._typeid = as_token(ctx)
        else:
            self.visitChildren(ctx)
1161884
final boolean completeValue(T t) {
    return U.compareAndSwapObject(this, RESULT, null, (t == null) ? NIL : t);
  }
147683
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) {
    Comparable threshold = getThreshold(condition, type);

    if (reachThreshold(value, threshold, condition)) {
      return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString()));
    }
    return Optional.empty();
  }
503350
function processValue(schema, value) {
  // "enum" is a reserved word, so only "type" and "items" can be destructured
  const { type, items } = schema;
  if (value === "") {
    return undefined;
  } else if (type === "array" && items && nums.has(items.type)) {
    return value.map(asNumber);
  } else if (type === "boolean") {
    return value === "true";
  } else if (type === "number") {
    return asNumber(value);
  }

  // If type is undefined, but an enum is present, try and infer the type from
  // the enum values
  if (schema.enum) {
    if (schema.enum.every(x => guessType(x) === "number")) {
      return asNumber(value);
    } else if (schema.enum.every(x => guessType(x) === "boolean")) {
      return value === "true";
    }
  }

  return value;
}