fix: accept []string and []int in matrix refs (#2544) - #2956
Open
no-hup wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2544.
Matrix
ref:only accepted a literal[]any, so a ref computed with a template function likesplitListcame back as[]stringand 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,[]stringand[]int. that set deliberately mirrors whatitemsFromForalready takes for literal lists, so nothing that worked before behaves differently, no reflect involved. Enum refs shared the same[]anyassertion 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-computedthat loops over asplitListref, 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.