summaryrefslogtreecommitdiff
path: root/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-08-20 17:01:23 -0700
committerTor Norbye <tnorbye@google.com>2014-08-20 17:01:23 -0700
commit1aa2e09bdbd413eacb677e9fa4b50630530d0656 (patch)
tree2f4cc6d69645bd460aa253fdecb606d764fbd25d /python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java
parent02cf98d65c798d368fcec43ed64a001d513bdd4f (diff)
downloadidea-1aa2e09bdbd413eacb677e9fa4b50630530d0656.tar.gz
Snapshot idea/138.1696 from git://git.jetbrains.org/idea/community.git
Change-Id: I50c97b83a815ce635e49a38380ba5b8765e4b16a
Diffstat (limited to 'python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java')
-rw-r--r--python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java
index 346d40f3273e..c28bc29455c9 100644
--- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java
+++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java
@@ -36,6 +36,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import static com.jetbrains.python.psi.PyUtil.as;
+
/**
* @author yole
*/
@@ -132,6 +134,23 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase {
}
}
}
+ else if ("__builtin__.tuple.__add__".equals(qname) && callSite instanceof PyBinaryExpression) {
+ final PyBinaryExpression expression = (PyBinaryExpression)callSite;
+ final PyTupleType leftTupleType = as(context.getType(expression.getLeftExpression()), PyTupleType.class);
+ if (expression.getRightExpression() != null) {
+ final PyTupleType rightTupleType = as(context.getType(expression.getRightExpression()), PyTupleType.class);
+ if (leftTupleType != null && rightTupleType != null) {
+ final PyType[] elementTypes = new PyType[leftTupleType.getElementCount() + rightTupleType.getElementCount()];
+ for (int i = 0; i < leftTupleType.getElementCount(); i++) {
+ elementTypes[i] = leftTupleType.getElementType(i);
+ }
+ for (int i = 0; i < rightTupleType.getElementCount(); i++) {
+ elementTypes[i + leftTupleType.getElementCount()] = rightTupleType.getElementType(i);
+ }
+ return PyTupleType.create(function, elementTypes);
+ }
+ }
+ }
}
return null;
}