Skip to content

Commit 39d14b1

Browse files
committed
#558: fix HeadMismatchInspection's incorrect behaviour with quoted atoms
1 parent d25e128 commit 39d14b1

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/org/intellij/erlang/psi/impl/ErlangPsiImplUtil.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,23 +1388,26 @@ public Icon getIcon(boolean b) {
13881388

13891389
@NotNull
13901390
public static String createFunctionPresentation(@NotNull ErlangAtomWithArityExpression function) {
1391-
return getName(function.getQAtom()) + "/" + getArity(function.getInteger());
1391+
return createFunctionPresentation(getName(function.getQAtom()), getArity(function.getInteger()));
13921392
}
13931393

13941394
@NotNull
1395-
public static String createFunctionClausePresentation(@Nullable ErlangFunctionClause clause) {
1396-
if (clause == null) return "";
1397-
return clause.getQAtom().getText() + "/" + calculateFunctionClauseArity(clause);
1395+
public static String createFunctionClausePresentation(@NotNull ErlangFunctionClause clause) {
1396+
return createFunctionPresentation(getName(clause.getQAtom()), calculateFunctionClauseArity(clause));
13981397
}
13991398

14001399
@NotNull
14011400
public static String createFunctionPresentation(@NotNull ErlangFunction function) {
1402-
return function.getName() + "/" + function.getArity();
1401+
return createFunctionPresentation(function.getName(), function.getArity());
14031402
}
14041403

14051404
@NotNull
14061405
public static String createFunctionPresentation(@NotNull ErlangImportFunction function) {
1407-
return getName(function.getQAtom()) + "/" + getArity(function.getInteger());
1406+
return createFunctionPresentation(getName(function.getQAtom()), getArity(function.getInteger()));
1407+
}
1408+
1409+
private static String createFunctionPresentation(String functionName, int arity) {
1410+
return toAtomName(functionName) + "/" + arity;
14081411
}
14091412

14101413
@NotNull
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-export([foo/0, ?foo/1]).
1+
-export([foo/0, ?foo/1, 'CAPS'/1]).
22

33
foo() -> ok;
44
<error>zoo</error>() -> ok;
@@ -8,4 +8,7 @@ foo() -> ok;
88
-define(bar, fun1).
99

1010
?foo(1) -> ok;
11-
?bar(2) -> ok.
11+
?bar(2) -> ok.
12+
13+
'CAPS'(1) -> ok;
14+
'CAPS'(2) -> ok.

0 commit comments

Comments
 (0)