Skip to content

Commit

Permalink
Use ... in Display for Callable
Browse files Browse the repository at this point in the history
Summary: Like [Python does](https://docs.python.org/3/library/typing.html#annotating-callables).

Reviewed By: IanChilds

Differential Revision: D63681890

fbshipit-source-id: a53a5f22beaee04631eff910e759d5244a7e59e5
  • Loading branch information
stepancheg authored and facebook-github-bot committed Oct 2, 2024
1 parent 5bfc3d5 commit 01639e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion starlark/src/typing/callable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 01639e2

Please sign in to comment.