Repository navigation
Conversation
`Selectors.List <: AbstractVector`, so JSON's `AbstractVector{<:Pair}`,
`AbstractVector{Any}` and `AbstractVector{Pair{K,Any}}` methods are
ambiguous with StructUtils' own `arraylike`/`applyeach` methods for
`List`. In particular `List{Any}`, which is what the selector syntax
returns, could not be written at all (MethodError), and `List` items
skipped `lower`, so `missing` was written as `"missing"`.
Define `arraylike` and `applyeach` for `List` on the JSON style: a List
is always written as a plain array of its lowered items, including
`List{<:Pair}`, which unlike `Vector{<:Pair}` is arraylike in StructUtils.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #502 +/- ##
==========================================
+ Coverage 92.57% 92.59% +0.01%
==========================================
Files 7 7
Lines 1927 1932 +5
==========================================
+ Hits 1784 1789 +5
Misses 143 143 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
StructUtils.Selectors.List <: AbstractVector, so JSON'sAbstractVector{<:Pair},AbstractVector{Any}andAbstractVector{Pair{K,Any}}methods are ambiguous with StructUtils' ownarraylike(::StructStyle, ::List)/applyeach(::StructStyle, f, ::List). Onmaster:This defines
arraylikeandapplyeachforListonJSONStyle: aListis always written as a plain array of its lowered items.Vector{Any}items keep JSON's concrete-dispatchapplyeach; anything else goes through StructUtils' genericAbstractArraymethod viainvoke, which bypasses theAbstractVector{<:Pair}object methods on purpose, sinceList{<:Pair}is arraylike in StructUtils unlikeVector{<:Pair}.After:
Found while working on #500 (the
Vector{Union{}}fix), whoseAbstractVector{Union{}}method has the sameList{Union{}}ambiguity; this PR resolves that one too, and the two PRs are independent.Selectors.Listexists in StructUtils since 2.7.1, within the current compat. Full test suite passes locally except for the pre-existing juliac--trimsegfault on Julia 1.12.7, which reproduces on unmodifiedmaster.🤖 Generated with Claude Code