mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Resolve '@' to '__matmul__' and '__rmatmul__' (PY-15390)
This commit is contained in:
@@ -118,7 +118,7 @@ public class PyTokenTypes {
|
||||
public static final PyElementType RBRACKET = new PyElementType("RBRACKET");// ]
|
||||
public static final PyElementType LBRACE = new PyElementType("LBRACE");// {
|
||||
public static final PyElementType RBRACE = new PyElementType("RBRACE");// }
|
||||
public static final PyElementType AT = new PyElementType("AT");// @
|
||||
public static final PyElementType AT = new PyElementType("AT", "__matmul__");// @
|
||||
public static final PyElementType COMMA = new PyElementType("COMMA");// ,
|
||||
public static final PyElementType COLON = new PyElementType("COLON");// :
|
||||
public static final PyElementType DOT = new PyElementType("DOT");// .
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class C:
|
||||
def __matmul__(self, other):
|
||||
return self
|
||||
|
||||
|
||||
x = C()
|
||||
x @ y
|
||||
# <ref>
|
||||
@@ -0,0 +1,8 @@
|
||||
class C:
|
||||
def __rmatmul__(self, other):
|
||||
return self
|
||||
|
||||
|
||||
x = C()
|
||||
y @ x
|
||||
# <ref>
|
||||
@@ -571,4 +571,14 @@ public class PyResolveTest extends PyResolveTestCase {
|
||||
public void testResolveAttributesUsingOldStyleMROWhenUnresolvedAncestorsAndC3Fails() {
|
||||
assertResolvesTo(PyFunction.class, "foo");
|
||||
}
|
||||
|
||||
// PY-15390
|
||||
public void testMatMul() {
|
||||
assertResolvesTo(PyFunction.class, "__matmul__");
|
||||
}
|
||||
|
||||
// PY-15390
|
||||
public void testRMatMul() {
|
||||
assertResolvesTo(PyFunction.class, "__rmatmul__");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user