buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

Starlark: support doc strings for records

Open lf- opened this issue 5 months ago • 0 comments

It would be helpful to be able to specify doc strings for records. This may be possible already and I just can't find it. Providers support a doc argument, but if given in a struct, it fails:

Caused by:
    0: Error evaluating module: `toolchains//nix.bzl@root`
    1: Traceback (most recent call last):
         * toolchains/nix.bzl:129, in <module>
             NixDerivationInfo = record(
       error: String literals are not allowed in type expressions: `"All the output paths for a derivation."`
          --> toolchains/nix.bzl:129:21
           |
       129 |   NixDerivationInfo = record(
           |  _____________________^
       130 | |     doc = """All the output paths for a derivation.""",
       131 | |     derivation = NixPathInfo,
       132 | |     outputs = dict[str, NixPathInfo],
       133 | | )
           | |_^
           |

lf- avatar Jul 14 '25 17:07 lf-