MichaelHatherly / CommonMark.jl

A CommonMark-compliant Markdown parser for Julia.
Other
84 stars 11 forks source link

Julia 1.0: no method matching get!(::getfield(CommonMark, Symbol("##106#108")), ::IdDict{CommonMark.Node,Dict{String,Int64}}, ::CommonMark.Node) #33

Open fonsp opened 2 years ago

fonsp commented 2 years ago

A wrote a sanity check for MarkdownLiteral.jl and it fails on Julia 1.0.

https://github.com/JuliaPluto/MarkdownLiteral.jl/runs/4565349515?check_suite_focus=true#step:4:55

You can run these tests yourself with:

julia> ]
pkg> add https://github.com/JuliaPluto/MarkdownLiteral.jl
pkg> test MarkdownLiteral

It looks like the problem is that Julia 1.0 did not have this method yet:

julia> get!(rand, IdDict(), 4)
ERROR: MethodError: no method matching get!(::typeof(rand), ::IdDict{Any,Any}, ::Int64)
Closest candidates are:
  get!(::IdDict{K,V}, ::Any, ::Any) where {K, V} at abstractdict.jl:649
  get!(::Dict{K,V}, ::Any, ::Any) where {K, V} at dict.jl:421
  get!(::Union{Function, Type}, ::Dict{K,V}, ::K) where {K, V} at dict.jl:448
  ...
Stacktrace:
 [1] top-level scope at none:0
fonsp commented 2 years ago

https://github.com/MichaelHatherly/CommonMark.jl/pull/34

fonsp commented 2 years ago

Instead, we could change the compat bound to 1.6 since julia 1.0 is not supported anymore. I only set it at 1 for MarkdownLiteral.jl because both commonmark and hypertextliteral support it