Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions conformance/third_party/conformance.exp
Original file line number Diff line number Diff line change
Expand Up @@ -5019,7 +5019,7 @@
"code": -2,
"column": 12,
"concise_description": "`+` is not supported between `AnyStr` and `AnyStr`",
"description": "`+` is not supported between `AnyStr` and `AnyStr`\n No matching overload found for function `str.__add__` called with arguments: (AnyStr)\n Possible overloads:\n (value: LiteralString, /) -> LiteralString\n (value: str, /) -> str [closest match]",
"description": "`+` is not supported between `AnyStr` and `AnyStr`\n No matching overload found for function `str.__add__` called with arguments: (AnyStr)\n Possible overloads:\n def (value: LiteralString, /) -> LiteralString:\n ...\n def (value: str, /) -> str:# [closest match]\n ...",
"line": 34,
"name": "unsupported-operation",
"severity": "error",
Expand Down Expand Up @@ -8265,7 +8265,7 @@
"code": -2,
"column": 1,
"concise_description": "Cannot index into `Bytes`",
"description": "Cannot index into `Bytes`\n No matching overload found for function `Bytes.__getitem__` called with arguments: (Literal[''])\n Possible overloads:\n (__i: int, /) -> int [closest match]\n (__s: slice[Any, Any, Any], /) -> bytes",
"description": "Cannot index into `Bytes`\n No matching overload found for function `Bytes.__getitem__` called with arguments: (Literal[''])\n Possible overloads:\n def (__i: int, /) -> int:# [closest match]\n ...\n def (__s: slice[Any, Any, Any], /) -> bytes:\n ...",
"line": 39,
"name": "bad-index",
"severity": "error",
Expand Down Expand Up @@ -8447,7 +8447,7 @@
"code": -2,
"column": 11,
"concise_description": "No matching overload found for function `example1_1` called with arguments: ()",
"description": "No matching overload found for function `example1_1` called with arguments: ()\n Possible overloads:\n (x: int, y: str) -> int\n (x: str) -> str [closest match]",
"description": "No matching overload found for function `example1_1` called with arguments: ()\n Possible overloads:\n def (\n x: int,\n y: str\n) -> int:\n ...\n def (x: str) -> str:# [closest match]\n ...",
"line": 38,
"name": "no-matching-overload",
"severity": "error",
Expand All @@ -8458,7 +8458,7 @@
"code": -2,
"column": 11,
"concise_description": "No matching overload found for function `example1_1` called with arguments: (Literal[1], Literal[1])",
"description": "No matching overload found for function `example1_1` called with arguments: (Literal[1], Literal[1])\n Possible overloads:\n (x: int, y: str) -> int [closest match]\n (x: str) -> str",
"description": "No matching overload found for function `example1_1` called with arguments: (Literal[1], Literal[1])\n Possible overloads:\n def (\n x: int,\n y: str\n) -> int:# [closest match]\n ...\n def (x: str) -> str:\n ...",
"line": 46,
"name": "no-matching-overload",
"severity": "error",
Expand All @@ -8469,7 +8469,7 @@
"code": -2,
"column": 11,
"concise_description": "No matching overload found for function `example1_1` called with arguments: (Literal[1])",
"description": "No matching overload found for function `example1_1` called with arguments: (Literal[1])\n Possible overloads:\n (x: int, y: str) -> int [closest match]\n (x: str) -> str",
"description": "No matching overload found for function `example1_1` called with arguments: (Literal[1])\n Possible overloads:\n def (\n x: int,\n y: str\n) -> int:# [closest match]\n ...\n def (x: str) -> str:\n ...",
"line": 51,
"name": "no-matching-overload",
"severity": "error",
Expand All @@ -8480,7 +8480,7 @@
"code": -2,
"column": 13,
"concise_description": "No matching overload found for function `example2` called with arguments: (int | str, int | str, Literal[1])",
"description": "No matching overload found for function `example2` called with arguments: (int | str, int | str, Literal[1])\n Possible overloads:\n (x: int, y: str, z: int) -> str [closest match]\n (x: int, y: int, z: int) -> int",
"description": "No matching overload found for function `example2` called with arguments: (int | str, int | str, Literal[1])\n Possible overloads:\n def (\n x: int,\n y: str,\n z: int\n) -> str:# [closest match]\n ...\n def (\n x: int,\n y: int,\n z: int\n) -> int:\n ...",
"line": 115,
"name": "no-matching-overload",
"severity": "error",
Expand Down Expand Up @@ -11302,7 +11302,7 @@
"code": -2,
"column": 10,
"concise_description": "No matching overload found for function `A.update` called with arguments: (TypedDict[A])",
"description": "No matching overload found for function `A.update` called with arguments: (TypedDict[A])\n Possible overloads:\n (m: Partial[A], /) -> None [closest match]\n (m: Iterable[tuple[Literal['y'], int]], /) -> None\n (*, y: int = ...) -> None",
"description": "No matching overload found for function `A.update` called with arguments: (TypedDict[A])\n Possible overloads:\n def (m: Partial[A], /) -> None:# [closest match]\n ...\n def (m: Iterable[tuple[Literal['y'], int]], /) -> None:\n ...\n def (*, y: int = ...) -> None:\n ...",
"line": 23,
"name": "no-matching-overload",
"severity": "error",
Expand Down
2 changes: 1 addition & 1 deletion conformance/third_party/conformance.result
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"Line 98: Expected 1 errors"
],
"generics_basic.py": [
"Line 34: Unexpected errors ['`+` is not supported between `AnyStr` and `AnyStr`\\n Argument `AnyStr` is not assignable to parameter `value` with type `Buffer` in function `bytes.__add__`\\n Protocol `Buffer` requires attribute `__buffer__`', '`+` is not supported between `AnyStr` and `AnyStr`\\n No matching overload found for function `str.__add__` called with arguments: (AnyStr)\\n Possible overloads:\\n (value: LiteralString, /) -> LiteralString\\n (value: str, /) -> str [closest match]', 'Returned type `bytes | Unknown` is not assignable to declared return type `AnyStr`']",
"Line 34: Unexpected errors ['`+` is not supported between `AnyStr` and `AnyStr`\\n Argument `AnyStr` is not assignable to parameter `value` with type `Buffer` in function `bytes.__add__`\\n Protocol `Buffer` requires attribute `__buffer__`', '`+` is not supported between `AnyStr` and `AnyStr`\\n No matching overload found for function `str.__add__` called with arguments: (AnyStr)\\n Possible overloads:\\n def (value: LiteralString, /) -> LiteralString:\\n ...\\n def (value: str, /) -> str:# [closest match]\\n ...', 'Returned type `bytes | Unknown` is not assignable to declared return type `AnyStr`']",
"Line 67: Unexpected errors ['assert_type(MyStr, str) failed']",
"Line 68: Unexpected errors ['assert_type(MyStr, str) failed', 'Argument `str` is not assignable to parameter `y` with type `MyStr` in function `concat`']"
],
Expand Down
5 changes: 3 additions & 2 deletions pyrefly/lib/alt/overload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
];
for overload in overloads {
let suffix = if overload.1.signature == closest_overload.func.1.signature {
" [closest match]"
"# [closest match]"
} else {
""
};
Expand All @@ -384,7 +384,8 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> {
let signature = self
.solver()
.for_display(Type::Callable(Box::new(signature)));
msg.push(format!("{signature}{suffix}"));
let signature = signature.as_hover_string();
msg.push(format!("def {signature}:{suffix}\n ..."));
}
// We intentionally discard closest_overload.call_errors. When no overload matches,
// there's a high likelihood that the "closest" one by our heuristic isn't the right
Expand Down
2 changes: 1 addition & 1 deletion pyrefly/lib/test/overload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def f(x: int, y: int) -> int: ...
def f(x: int, y: int = 0) -> int:
return x + y

f(0, 1, 2) # E: (x: int, y: int) -> int [closest match]
f(0, 1, 2) # E: (\n x: int,\n y: int\n) -> int:# [closest match]
"#,
);

Expand Down
Loading