InferredTypes { public static boolean isDeclaredTypeWithTypeClass(InferredType type, String typeName) { if (type instanceof DeclaredType) { Symbol typeClass = ((DeclaredType) type).getTypeClass(); return typeName.equals(typeClass.fullyQualifiedName()); } return false; } private  InferredTypes(); static boolean isInitialized(); static InferredType anyType(); static InferredType runtimeType(@Nullable Symbol typeClass); static InferredType or(InferredType t1, InferredType t2); static InferredType union(Stream<InferredType> types); static InferredType fromTypeAnnotation(TypeAnnotation typeAnnotation); static InferredType fromTypeshedTypeAnnotation(TypeAnnotation typeAnnotation); static Collection<ClassSymbol> typeSymbols(InferredType inferredType); @CheckForNull static String typeName(InferredType inferredType); @CheckForNull static LocationInFile typeClassLocation(InferredType inferredType); static boolean isDeclaredTypeWithTypeClass(InferredType type, String typeName); static boolean containsDeclaredType(InferredType type); static final InferredType INT; static final InferredType DECL_INT; static final InferredType FLOAT; static final InferredType DECL_FLOAT; static final InferredType COMPLEX; static final InferredType DECL_COMPLEX; static final InferredType STR; static final InferredType DECL_STR; static final InferredType SET; static final InferredType DECL_SET; static final InferredType DICT; static final InferredType DECL_DICT; static final InferredType LIST; static final InferredType DECL_LIST; static final InferredType TUPLE; static final InferredType DECL_TUPLE; static final InferredType NONE; static final InferredType DECL_NONE; static final InferredType BOOL; static final InferredType DECL_BOOL; }
@Test public void test_isDeclaredTypeWithTypeClass() { assertThat(isDeclaredTypeWithTypeClass(DECL_INT, "int")).isTrue(); assertThat(isDeclaredTypeWithTypeClass(INT, "int")).isFalse(); assertThat(isDeclaredTypeWithTypeClass(lastExpression( "from typing import List", "def f(p: List[int]): p" ).type(), "list")).isTrue(); }