mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Result of in operation is always bool (PY-31956)
This commit is contained in:
@@ -136,6 +136,9 @@ public class PyBinaryExpressionImpl extends PyElementImpl implements PyBinaryExp
|
||||
}
|
||||
return PyUnionType.union(leftType, rightType);
|
||||
}
|
||||
|
||||
if (PyNames.CONTAINS.equals(getReferencedName())) return PyBuiltinCache.getInstance(this).getBoolType();
|
||||
|
||||
final List<PyCallExpression.PyArgumentsMapping> results =
|
||||
PyCallExpressionHelper.mapArguments(this, PyResolveContext.noImplicits().withTypeEvalContext(context));
|
||||
if (!results.isEmpty()) {
|
||||
|
||||
@@ -3305,6 +3305,16 @@ public class PyTypeTest extends PyTestCase {
|
||||
" expr = a");
|
||||
}
|
||||
|
||||
// PY-31956
|
||||
public void testInAndNotBoolContains() {
|
||||
doTest("bool",
|
||||
"class MyClass:\n" +
|
||||
" def __contains__(self):\n" +
|
||||
" return 42\n" +
|
||||
"\n" +
|
||||
"expr = 1 in MyClass()");
|
||||
}
|
||||
|
||||
// PY-32533
|
||||
public void testSuperWithAnotherType() {
|
||||
runWithLanguageLevel(
|
||||
|
||||
Reference in New Issue
Block a user