Skip to content

Commit 2730cd1

Browse files
committed
fix: accept any AbstractDict in _normalize_theme
JSON.jl v1 returns JSON.Object{String,Any} from parsefile, which is AbstractDict but not Dict. The previous `::Dict` signature dispatched fine on JSON 0.21 (which returned Dict) but failed with MethodError on v1. Relaxing to AbstractDict keeps the function working on both — the inner `attrs isa Dict` guard is widened to `isa AbstractDict` for the same reason. Required to land #15 (CompatHelper: bump compat for JSON to 1). Validated locally: 982/982 tests pass on both JSON 0.21 and 1.6.
1 parent b2ae4e3 commit 2730cd1

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111

1212
- Apply JuliaFormatter v2.3.0 (blue style) across the codebase. Whitespace-only changes — no behavior change. The `Format Check` workflow was added recently and only runs on pull requests, so the v1→v2 style drift on `main` had gone unnoticed until CompatHelper PRs (#13, #14, #15) tripped the check.
13+
- `_normalize_theme` accepts any `AbstractDict` (previously `Dict` only). This lets `load_theme` work with JSON.jl v1, whose `parsefile` returns `JSON.Object{String,Any} <: AbstractDict` rather than `Dict{String,Any}`. Tests pass against both JSON 0.21 and 1.6.
1314

1415
## [0.5.3] - 2026-05-13
1516

src/themes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ $(SIGNATURES)
277277
Normalize a raw parsed dictionary into a Theme.
278278
Ensures all inner values are Dict{String, Any}.
279279
"""
280-
function _normalize_theme(raw::Dict)::Theme
280+
function _normalize_theme(raw::AbstractDict)::Theme
281281
theme = Theme()
282282
for (section, attrs) in raw
283-
if attrs isa Dict
283+
if attrs isa AbstractDict
284284
theme[string(section)] = Dict{String,Any}(string(k) => v for (k, v) in attrs)
285285
end
286286
end

0 commit comments

Comments
 (0)