void (@NotNull PsiElement target, @NotNull TypeEvalContext context, @NotNull StringBuilder builder, @NotNull List<PyType> types, @NotNull List<TextRange> typeRanges) { if (target instanceof PyParenthesizedExpression) { final PyExpression contained = ((PyParenthesizedExpression)target).getContainedExpression(); if (contained != null) { generateNestedTypeHint(contained, context, builder, types, typeRanges); } } else if (target instanceof PyTupleExpression) { builder.append("("); final PyExpression[] elements = ((PyTupleExpression)target).getElements(); for (int i = 0; i < elements.length; i++) { if (i > 0) { builder.append(", "); } generateNestedTypeHint(elements[i], context, builder, types, typeRanges); } builder.append(")"); } else if (target instanceof PyTypedElement) { final PyType singleTargetType = getInferredTypeOrObject((PyTypedElement)target, context); PyTypeHintGenerationUtil.checkPep484Compatibility(singleTargetType, context); final String singleTargetAnnotation = PythonDocumentationProvider.getTypeHint(singleTargetType, context); types.add(singleTargetType); typeRanges.add(TextRange.from(builder.length(), singleTargetAnnotation.length())); builder.append(singleTargetAnnotation); } }