diff options
Diffstat (limited to 'python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java')
-rw-r--r-- | python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java b/python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java index 04477b1be313..e793de32c173 100644 --- a/python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java @@ -78,15 +78,17 @@ public class PyCallingNonCallableInspection extends PyInspection { } if (!callable) { final PyType calleeType = callee != null ? myTypeEvalContext.getType(callee) : type; + String message = "Expression is not callable"; if (calleeType instanceof PyClassType) { - registerProblem(node, String.format("'%s' object is not callable", calleeType.getName()), new PyRemoveCallQuickFix()); + message = String.format("'%s' object is not callable", calleeType.getName()); } else if (callee != null) { - registerProblem(node, String.format("'%s' is not callable", callee.getName()), new PyRemoveCallQuickFix()); - } - else { - registerProblem(node, "Expression is not callable", new PyRemoveCallQuickFix()); + final String name = callee.getName(); + if (name != null) { + message = String.format("'%s' is not callable", name); + } } + registerProblem(node, message, new PyRemoveCallQuickFix()); } } } |