Skip to content

Commit

Permalink
Properly consider that a method containing ... is an empty method and…
Browse files Browse the repository at this point in the history
… don't report unused arguments in it.
  • Loading branch information
fabioz committed Oct 1, 2023
1 parent 8d835ea commit 6eb37eb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ public void addUnusedMessage(SimpleNode node, Found f) {
if (expr.value instanceof Str) {
continue;
}
if (expr.value instanceof Name) {
Name name = (Name) expr.value;
if ("...".equals(name.id)) {
continue;
}

}
}
addMessage = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,21 @@ public void testTypingWithLiterals() {
+ "");
checkNoError();
}

public void testOverload() {
doc = new Document("from typing import overload\n"
+ "\n"
+ "\n"
+ "class C:\n"
+ " @overload\n"
+ " def foo(self, a: int) -> None: ...\n"
+ "\n"
+ " @overload\n"
+ " def foo(self, a: str) -> None: ...\n"
+ "\n"
+ " def foo(self, a: int | str) -> None:\n"
+ " print(a) # dummy impl"
+ "");
checkNoError();
}
}

0 comments on commit 6eb37eb

Please sign in to comment.