Skip to content

Implement array.flatten builtin#148

Merged
sspaink merged 1 commit into
open-policy-agent:mainfrom
ume3445:implement-array-flatten
Jul 13, 2026
Merged

Implement array.flatten builtin#148
sspaink merged 1 commit into
open-policy-agent:mainfrom
ume3445:implement-array-flatten

Conversation

@ume3445

@ume3445 ume3445 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements array.flatten as described in #143.

Changes

  • Added ArrayFlatten to ArrayBuiltins.java, following the same pattern as the existing array.concat/slice/reverse builtins
  • Flattens exactly one level of nesting per the compliance test fixture, non-array elements pass through unchanged
  • Throws a TypeError matching the existing message format when the operand isn't an array

Testing

  • Ran the full compliance suite locally: all 6 array/flatten cases pass
  • Full opa-evaluator suite passes with no regressions (2096 tests, 0 failures, 0 errors)

Closes #143.

Signed-off-by: Muhammad Umer Hammad <umerhammad010@gmail.com>
@ume3445
ume3445 force-pushed the implement-array-flatten branch from 2759ae0 to 24db8c5 Compare July 10, 2026 23:21

@sspaink sspaink left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sspaink
sspaink merged commit a7056d3 into open-policy-agent:main Jul 13, 2026
14 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.

Implement array.flatten builtin

2 participants