Visitar URL original
Invoke multi-argument-input functions positionally in PCL by iwahbe · Pull Request #23571 · pulumi/pulumi · GitHub
Skip to content

Invoke multi-argument-input functions positionally in PCL - #23571

Merged
iwahbe merged 2 commits into
masterfrom
iwahbe/improve-multi-arg-pcl-syntax
Jul 7, 2026
Merged

iwahbe merged 2 commits into
masterfrom
iwahbe/improve-multi-arg-pcl-syntax

Conversation

@iwahbe

@iwahbe iwahbe commented Jun 15, 2026

Copy link
Copy Markdown
Member

Description

A function declared with multiArgumentInputs is now invoked in PCL by passing its inputs positionally rather than as a single object argument:

# before
invoke("pkg:index:fn", { p1 = arg1, p2 = arg2 })
# now
invoke("pkg:index:fn", arg1, arg2)

The binder rejects the object-argument form for such functions with a clear diagnostic ("function … is declared with multi-argument inputs and must be invoked with positional arguments…").

The optional invokeOptions object is passed as a final positional argument, after one argument per input. To supply options while omitting an optional input, pass null for that input:

invoke("pkg:index:fn", arg1, null, { provider = p })

Anything beyond one argument per input plus the options object is rejected.

How it works

Positional invokes bind against a per-input signature (token, input₁, …, inputₙ, invokeOptions?), and a post-bind pass normalizes the call back into the object-argument form. As a result the rest of PCL and every program generator continue to observe only the object form — no generator changes are needed, and PCL itself round-trips the positional source.

The l2-invoke-multi-argument conformance program is updated to the positional form (its PCL snapshots regenerate accordingly; TypeScript output is unchanged because the normalized object form is identical).

The schema lookup shared by signature binding and the post-bind normalization is factored into invokeTokenArgument and the binder's loadPackageSchema helper.

Testing

  • New unit tests in pkg/codegen/pcl/invoke_positional_test.go: object-argument form rejected, positional happy paths, optional-input omission, invokeOptions as a trailing argument (with and without a null placeholder), and too-many-arguments rejection. A multiarg test schema fixture is added.
  • l2-invoke-multi-argument conformance passes for PCL and TypeScript (Go and Python remain expected failures, unchanged).
  • make lint_golang is clean.

Checklist

  • I have run make lint to verify my code passes the lint check
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change

@iwahbe
iwahbe requested a review from a team as a code owner June 15, 2026 18:11
iwahbe added 2 commits July 6, 2026 11:07
A function declared with `multiArgumentInputs` is now invoked in PCL by
passing its inputs positionally rather than as a single object argument:

    invoke("pkg:index:fn", arg1, arg2)

The binder rejects the object-argument form for such functions with a clear
diagnostic. The optional `invokeOptions` object is passed as a final
positional argument, after one argument per input; to supply options while
omitting an optional input, pass `null` for that input:

    invoke("pkg:index:fn", arg1, null, { provider = p })

Positional invokes are bound against a per-input signature and then
normalized back to the object-argument form after binding, so the rest of
PCL and every program generator continue to observe only the object form.
The `l2-invoke-multi-argument` conformance program is updated to the
positional form accordingly.

The schema lookup shared by signature binding and the post-bind
normalization is factored into `invokeTokenArgument` and the binder's
`loadPackageSchema` helper.
@iwahbe
iwahbe force-pushed the iwahbe/improve-multi-arg-pcl-syntax branch from 0545809 to 59d71a7 Compare July 6, 2026 09:12
@iwahbe
iwahbe added this pull request to the merge queue Jul 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@iwahbe
iwahbe added this pull request to the merge queue Jul 7, 2026
Merged via the queue into master with commit 4a79549 Jul 7, 2026
122 of 123 checks passed
@iwahbe
iwahbe deleted the iwahbe/improve-multi-arg-pcl-syntax branch July 7, 2026 17:19
@i-am-tom i-am-tom mentioned this pull request Jul 8, 2026
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.251.0.

pull Bot pushed a commit to makesoftwaresafe/pulumi that referenced this pull request Jul 8, 2026
## 3.251.0 (2026-07-08)

### Features

- [programgen/pcl] Invoke functions declared with multi-argument inputs
using positional arguments in PCL
[pulumi#23571](pulumi#23571)
- [sdkgen] Generate SDKs and programs for extension-parameterized
packages [pulumi#23579](pulumi#23579)
- [engine] Add `TargetSnippets` to deployment options to target snippets
by UUID.

### Bug Fixes

- [cli/display] Prevent plugin debug logs from appearing as raw JSON in
the CLI's output when logging with `--logtostderr`
[pulumi#23633](pulumi#23633)
- [cli] Show a `retain` marker for retain-on-delete resources in
`--diff` output
- [sdk/nodejs] Don't include the version in module paths when
serializing functions when using pnpm
- [cli] Don't miscopy out archives

### Improvements

- [cli/deployment] `pulumi deployment settings` no longer writes the
local `Pulumi.<stack>.deploy.yaml` file: the experimental `init`,
`pull`, `configure`, and `env` subcommands have been removed, and the
CLI no longer calls the deployment-settings encrypt endpoint.
`get`/`edit`/`destroy` continue to manage settings directly in Pulumi
Cloud [pulumi#23480](pulumi#23480)
- [cli/import] Support importing resources under parameterized providers
from a converter or import file
[pulumi#23763](pulumi#23763)
- [cli/import] Support importing resources under extension-parameterized
providers [pulumi#23779](pulumi#23779)
- [engine] Add OpenTelemetry spans to the StackReference read path so
performance traces can pinpoint slow snapshot fetches, deserialization,
or secret decryption
- [cli/deployment] The deployment settings file
(`Pulumi.<stack>.deploy.yaml`) has been removed entirely. The
experimental `pulumi deployment settings push` (`update`/`up`) command,
the `--config-file` flag, and the SDK helpers that read the file have
been removed. Manage deployment settings directly in Pulumi Cloud with
`pulumi deployment settings get`, `edit`, and `destroy`
[pulumi#23480](pulumi#23480)
- [cli/env] Report the new revision number when an environment
definition is updated (e.g. `pulumi env edit`, `pulumi env provider`,
`pulumi env version rollback`)
[pulumi#23799](pulumi#23799)
- [cli/convert] Add an `ecosystem` field to converter mapping requests
so a converter can request mappings for the ecosystem it consumes rather
than its own name [pulumi#23804](pulumi#23804)

### Miscellaneous

- [cli] Add `pulumi neo --debug-update` and `pulumi neo --debug-preview`
flags to investigate a failed update or preview, suggested in the
failure output [pulumi#23499](pulumi#23499)
- [cli/env] Fold the Pulumi ESC engine and CLI into the pulumi/pulumi
monorepo, removing the sdk↔esc Go module cycle. Internal refactor with
no user-facing behavior change; `pulumi env`/`pulumi esc` are
unaffected. [pulumi#23746](pulumi#23746)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants