private static boolean isDynamicallyEvaluated(
     @NotNull Collection<PyNamedParameter> parameters, @NotNull TypeEvalContext context) {
   for (PyNamedParameter parameter : parameters) {
     final PyType type = context.getType(parameter);
     if (type instanceof PyDynamicallyEvaluatedType) {
       return true;
     }
   }
   return false;
 }
 @Override
 public void visitPyReturnStatement(PyReturnStatement node) {
   if (PsiTreeUtil.getParentOfType(node, ScopeOwner.class, true) == myFunction) {
     final PyExpression expr = node.getExpression();
     PyType returnType;
     returnType = expr == null ? PyNoneType.INSTANCE : myContext.getType(expr);
     if (!myHasReturns) {
       myResult = returnType;
       myHasReturns = true;
     } else {
       myResult = PyUnionType.union(myResult, returnType);
     }
   }
 }
 @Nullable
 private PyType replaceSelf(
     @Nullable PyType returnType,
     @Nullable PyExpression receiver,
     @NotNull TypeEvalContext context) {
   if (receiver != null) {
     // TODO: Currently we substitute only simple subclass types, but we could handle union and
     // collection types as well
     if (returnType instanceof PyClassType) {
       final PyClassType returnClassType = (PyClassType) returnType;
       if (returnClassType.getPyClass() == getContainingClass()) {
         final PyType receiverType = context.getType(receiver);
         if (receiverType instanceof PyClassType
             && PyTypeChecker.match(returnType, receiverType, context)) {
           return returnClassType.isDefinition()
               ? receiverType
               : ((PyClassType) receiverType).toInstance();
         }
       }
     }
   }
   return returnType;
 }