Skip to content

Fix ARM function naming in arity errors and enhance compile-error tests - #867

Merged
Anand Krishnamoorthi (anakrish) merged 2 commits into
microsoft:mainfrom
snehabandla:split/azure-policy-arity-errors
Oct 27, 2026
Merged

Anand Krishnamoorthi (anakrish) merged 2 commits into
microsoft:mainfrom
snehabandla:split/azure-policy-arity-errors

Conversation

@snehabandla

Copy link
Copy Markdown
Contributor

Summary

Arity errors in Azure Policy now name the ARM function the author wrote. Previously, more than 8 arguments to a function such as and(), or(), union() or format() reported the internal builtin name (builtin call … exceeds max 8 args). Now the error reads, for example, union() does not support more than 8 arguments (got 9).

The compiler tracks the ARM function currently being compiled in current_arm_function. It saves and restores that value around nested calls, so the error names the innermost function that overflowed.

This PR also tightens the test harness. A case with want_compile_error: false plus want_compile_error_contains, or a compile-error case that also names an effect, used to pass without checking the conflicting field. Such cases now fail.

Behavior change

The error text changes. Callers in any of the 9 bindings that match on the old message will see the new text.

Tests

tests/azure_policy/cases/builtin_arity.yaml:

  • 9-argument and(), or() and union() (generic dispatch) name the ARM function.
  • Uppercase function names report the lowercase ARM name.
  • A nested overflow is attributed to the inner function (format()).
  • An overflow after a completed nested call names the caller.
  • 8-argument boundary cases still compile and evaluate, and packed concat() still accepts more than 8 arguments.
  • New harness checks reject contradictory compile-error expectations.

snehabandla and others added 2 commits October 26, 2026 23:11
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A case with want_compile_error: false plus want_compile_error_contains,
or a compile-error case that also names an effect, used to pass without
checking the conflicting field. Also cover union() at the 8-argument
boundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@anakrish
Anand Krishnamoorthi (anakrish) merged commit 1b92685 into microsoft:main Oct 27, 2026
60 checks passed
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.

2 participants