Compeltion for matrix multiplication methods (PY-15390)

This commit is contained in:
Andrey Vlasovskikh
2015-03-24 18:58:53 +03:00
parent 1cc48a15bd
commit a77b51054b
4 changed files with 30 additions and 1 deletions
@@ -357,8 +357,23 @@ public class PyNames {
.put("__round__", new BuiltinDescription("(self, n=None)"))
.build();
public static ImmutableMap<String, BuiltinDescription> PY35_BUILTIN_METHODS = ImmutableMap.<String, BuiltinDescription>builder()
.putAll(PY3_BUILTIN_METHODS)
.put("__imatmul__", _self_other_descr)
.put("__matmul__", _self_other_descr)
.put("__rmatmul__", _self_other_descr)
.build();
public static ImmutableMap<String, BuiltinDescription> getBuiltinMethods(LanguageLevel level) {
return level.isPy3K() ? PY3_BUILTIN_METHODS : PY2_BUILTIN_METHODS;
if (level.isAtLeast(LanguageLevel.PYTHON35)) {
return PY35_BUILTIN_METHODS;
}
else if (level.isAtLeast(LanguageLevel.PYTHON30)) {
return PY3_BUILTIN_METHODS;
}
else {
return PY2_BUILTIN_METHODS;
}
}
// canonical names, not forced by interpreter
@@ -0,0 +1,2 @@
class C:
def __matmul__(self, other):
+2
View File
@@ -0,0 +1,2 @@
class C:
def __matmul<caret>
@@ -141,4 +141,14 @@ public class Py3CompletionTest extends PyTestCase {
public void testNotImportedSubmodulesOfNamespacePackage() {
doMultiFileTest();
}
// PY-15390
public void testMatMul() {
runWithLanguageLevel(LanguageLevel.PYTHON35, new Runnable() {
@Override
public void run() {
doTest();
}
});
}
}