From 01639e297e05a77f8ba392b5a5d13b9c4d50842d Mon Sep 17 00:00:00 2001 From: Stiopa Koltsov Date: Tue, 1 Oct 2024 17:19:44 -0700 Subject: [PATCH] Use ... in Display for Callable Summary: Like [Python does](https://docs.python.org/3/library/typing.html#annotating-callables). Reviewed By: IanChilds Differential Revision: D63681890 fbshipit-source-id: a53a5f22beaee04631eff910e759d5244a7e59e5 --- starlark/src/typing/callable.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/starlark/src/typing/callable.rs b/starlark/src/typing/callable.rs index b4623e73e..d05f181a1 100644 --- a/starlark/src/typing/callable.rs +++ b/starlark/src/typing/callable.rs @@ -83,7 +83,9 @@ impl Display for TyCallable { write!(f, "typing.Callable")?; } else { write!(f, "typing.Callable[")?; - if let Some(pos) = self.params().all_required_pos_only() { + if self.params().is_any() { + write!(f, "...")?; + } else if let Some(pos) = self.params().all_required_pos_only() { write!(f, "[")?; for (i, p) in pos.iter().enumerate() { if i != 0 {