mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't raise none assignment warning when return type is not None (PY-28729)
This commit is contained in:
@@ -62,7 +62,7 @@ public class PyNoneFunctionAssignmentInspection extends PyInspection {
|
||||
|
||||
if (type instanceof PyNoneType && callee != null) {
|
||||
final Condition<PyCallable> ignoredCallable = callable -> {
|
||||
if (PySdkUtil.isElementInSkeletons(callable)) {
|
||||
if (myTypeEvalContext.getReturnType(callable) != PyNoneType.INSTANCE || PySdkUtil.isElementInSkeletons(callable)) {
|
||||
return true;
|
||||
}
|
||||
if (callable instanceof PyFunction) {
|
||||
|
||||
+9
@@ -33,6 +33,15 @@ public class Py3NoneFunctionAssignmentInspectionTest extends PyInspectionTestCas
|
||||
doMultiFileTest();
|
||||
}
|
||||
|
||||
// PY-28729
|
||||
public void testGenericSubstitutedWithNone() {
|
||||
doTestByText(
|
||||
"test1 = max([])\n" +
|
||||
"test2 = max([], default=None)\n" +
|
||||
"test3 = max([], default=0)"
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user