Ref<PyType> (@NotNull PyCallable callable, @NotNull Context context) { if (callable instanceof PyFunction function) { if (isTypeGuard(function, context.myContext)) { return Ref.create(PyBuiltinCache.getInstance(callable).getBoolType()); } final PyExpression returnTypeAnnotation = getReturnTypeAnnotation(function, context.myContext); if (returnTypeAnnotation != null) { final Ref<PyType> typeRef = getType(returnTypeAnnotation, context); if (typeRef != null) { return Ref.create(toAsyncIfNeeded(function, typeRef.get())); } // Don't rely on other type providers if a type hint is present, but cannot be resolved. return Ref.create(); } } return null; }