MCPcopy Create free account
hub / github.com/bazelbuild/bazel / type

Method type

src/main/java/net/starlark/java/eval/TypeChecker.java:148–161  ·  view source on GitHub ↗
(Object value)

Source from the content-addressed store, hash-verified

146 }
147
148 static StarlarkType type(Object value) {
149 if (value instanceof StarlarkValue val) {
150 StarlarkType type = val.getStarlarkType();
151 // Workaround for test mocks that generate getStarlarkType returning null
152 return Objects.requireNonNullElse(type, Types.ANY);
153 }
154 if (value instanceof Boolean) {
155 return Types.BOOL;
156 }
157 if (value instanceof String) {
158 return Types.STR;
159 }
160 throw new IllegalArgumentException("Expected a valid Starlark value.");
161 }
162
163 private static class ParameterizedTypeImpl implements ParameterizedType {
164 private final Type rawType;

Callers 8

testStringFieldsMethod · 0.95
testListFieldsMethod · 0.95
getStarlarkTypeMethod · 0.95
isValueSubtypeOfMethod · 0.95
newFunctionMethod · 0.95
callMethod · 0.95
fromAnnotationMethod · 0.45

Calls 1

getStarlarkTypeMethod · 0.65

Tested by 3

testStringFieldsMethod · 0.76
testListFieldsMethod · 0.76