Skip to content

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

Merged
vmaerten merged 1 commit into
go-task:mainfrom
no-hup:fix-2544-matrix-ref-list-types
Aug 10, 2026
Merged

fix: accept []string and []int in matrix refs#2956
vmaerten merged 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.

@vmaerten vmaerten changed the title fix: accept []string and []int in matrix refs (#2544) fix: accept []string and []int in matrix refs Aug 10, 2026
@vmaerten vmaerten self-assigned this Aug 10, 2026
@vmaerten
vmaerten self-requested a review August 10, 2026 17:47

@vmaerten vmaerten 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.

LGTM
Thanks!

@vmaerten
vmaerten merged commit 85aca58 into go-task:main Aug 10, 2026
16 checks passed
vmaerten added a commit that referenced this pull request Aug 10, 2026
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

2 participants