tests: accept AbstractDict for compatibility with JSON.jl v1#23
Merged
Conversation
JSON.jl v1 parses JSON objects into JSON.Object{String,Any} rather than Dict{String,Any}. Several method signatures were restricted to Dict{String,Any}, so the OPA partial-compile results (which are JSON-parsed) no longer matched on current Julia, breaking the Config API and Compile API testsets. (The suite still passed on Julia 1.6, which resolves an older JSON.jl that returns Dict.)
Widen the affected signatures to AbstractDict, which JSON.Object is a subtype of: the QuerySet AST-walk entry point in src/utils/ast.jl (production code, so consumers passing JSON.Object results now work), the standalone reference translator's translate(), and two Config API isa(..., Dict) assertions in the test suite.
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.
Summary
JSON.jl v1 parses JSON objects into
JSON.Object{String,Any}rather thanDict{String,Any}. Several method signatures were restricted toDict{String,Any}, so OPA partial-compile results (which are JSON-parsed) no longer matched on current Julia — breaking the Config API and Compile API testsets. The suite still passed on Julia 1.6, which resolves an older JSON.jl that returnsDict, which is why this only surfaced recently.Changes
Widen the affected signatures to
AbstractDict(JSON.Object <: AbstractDict):src/utils/ast.jl— theQuerySetAST-walk entry point_visit(::ASTVisitor, ::Type{QuerySet}, node). This is production code, so consumers passing JSON.Object-typed partial-compile results now work.test/sql_translate.jl— the standalone reference translator'stranslate().test/runtests.jl— twoisa(..., Dict)assertions in the Config API testset.Verification
Full suite passes (155/155) on current Julia with JSON v1.6.1.