Repository navigation
Drop read keywords for Symbol, VersionNumber, Regex, and sets - #112
Open
quinnj-bot[bot] wants to merge 2 commits into
Open
quinnj-bot[bot] wants to merge 2 commits into
quinnj-bot[bot] wants to merge 2 commits into
Conversation
…nd sets These fail on main: construct forwards the keywords to constructors that take none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
construct fell back to T(args...; kw...) for these types, and their Base constructors take no keywords, so a JSON3 typed read with dateformat or allow_inf threw a MethodError when it reached one of them. construct now calls their constructors without the keywords, as it does for UUID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
+ Coverage 78.38% 78.58% +0.20%
==========================================
Files 2 2
Lines 421 425 +4
==========================================
+ Hits 330 334 +4
Misses 91 91 ☔ 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.
Why
A JSON3 typed read passes its keywords (
dateformat,allow_inf,parsequoted, ...) toStructTypes.construct. ForSymbol,VersionNumber,Regex, and sets,constructfalls back toT(args...; kw...), and those Base constructors take no keywords. So a read that passes any keyword fails as soon as it reaches one of these types:In practice this hits a struct with a
Datefield read withdateformat=...that also has aSet,Symbol,VersionNumber, orRegexfield.What changed
construct(T, ::String; kw...)forSymbol,VersionNumber, andRegex, andconstruct(T, ::AbstractVector; kw...)forAbstractSet, call the constructor without the keywords, as Remove keyword arguments before calling UUID constructor #86 did forUUID.Scope
T(args...; kw...), so their constructors still receive the keywords.Blast Radius
Calls without keywords give the same result as before. Calls with keywords that threw a
MethodErrornow succeed.Verification
UUIDandDatekeyword tests: all 6 throw aMethodErroronmainand pass on this branch.Pkg.test()passes on Julia 1.12.6, and JSON3's own test suite passes with this branch.JSON3.read(json, T; allow_inf=true)forSet{Int},Set,BitSet,VersionNumber,Regex, and an escapedSymbolall read; without the branch all six throw.🤖 Generated with Claude Code