summaryrefslogtreecommitdiff
path: root/python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-07-16 18:07:37 -0700
committerTor Norbye <tnorbye@google.com>2014-07-16 18:09:03 -0700
commit65f60eb9011bb2c549a6d83ae31257480368ddc5 (patch)
treede0dca03bec460e8797332e5f460400f5cf6485f /python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java
parent9ea67227e8fdcf8ed37e65bb96e32767291d0f4f (diff)
downloadidea-65f60eb9011bb2c549a6d83ae31257480368ddc5.tar.gz
Snapshot idea/138.1029 from git://git.jetbrains.org/idea/community.git
Update from idea/138.538 to idea/138.1029 Change-Id: I828f829a968439a99ec67640990c18ff7c9b58ce
Diffstat (limited to 'python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java')
-rw-r--r--python/src/com/jetbrains/python/inspections/PyCallingNonCallableInspection.java12
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());
}
}
}