Skip to content

fix: accept []string and []int in matrix refs (#2544) - #2956

Open
no-hup wants to merge 1 commit into
go-task:mainfrom
no-hup:fix-2544-matrix-ref-list-types
Open

fix: accept []string and []int in matrix refs (#2544)#2956
no-hup wants to merge 1 commit into
go-task:mainfrom
no-hup:fix-2544-matrix-ref-list-types

Conversation

@no-hup

@no-hup no-hup commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #2544.

Matrix ref: only accepted a literal []any, so a ref computed with a template function like splitList came back as []string and failed with "must resolve to a list" even though its a perfectly good list. trulede already pinned this down on the issue, the type switch just never matched.

The fix adds a small helper (resolvedAsAnySlice) that accepts []any, []string and []int. that set deliberately mirrors what itemsFromFor already takes for literal lists, so nothing that worked before behaves differently, no reflect involved. Enum refs shared the same []any assertion so they get the same widening.

Tests: a table test for the conversion (any/string/int slices plus two error cases) and an end-to-end fixture task loop-matrix-ref-computed that loops over a splitList ref, with a golden file. go test ./... is green locally.

Disclosure: I used an AI assistant to help implement and test this change. I've reviewed and verified it and I'm happy to explain or revise anything here.

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.

Can't use computed lists in matrix loops

1 participant