bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
103 stars 40 forks source link

varargs ordering lost #226

Closed rickeylev closed 1 month ago

rickeylev commented 1 month ago

It appears that the position of *args in a signature is lost after parsing. Given this:

def f(a, *args, b=1):
  pass

The proto output shows args in the last position, but it should be the second:

parameter {
  name: "a"
  default_value: "1"
}
parameter {
  name: "b"
  default_value: "1"
}
parameter {
  name: "args"
}

The two signatures described are slightly different: the real function describes something that takes a variable number of positional args, and b must be a keyword arg. The proto output describes something that allows b to be a positional arg.

tetromino commented 1 month ago

Unfortunately, we'd need to fix this in Bazel in the proto extractor...

tetromino commented 1 month ago

I am folding this issue into #225 because they are the same problem with the same solution.