Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.5 gives errors on strings, on Julia 1.12 #92

Closed
mcabbott opened this issue Nov 4, 2024 · 5 comments · Fixed by #93
Closed

Version 0.5 gives errors on strings, on Julia 1.12 #92

mcabbott opened this issue Nov 4, 2024 · 5 comments · Fixed by #93

Comments

@mcabbott
Copy link
Member

mcabbott commented Nov 4, 2024

julia> using Functors

julia> fmap(x -> @show(x), (a=1, b="23"))
Internal error: during type inference of
execute(Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, Main.var"#8#9", typeof(Functors.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, Main.var"#8#9", typeof(Functors.isleaf)}, Base.IdDict{Any, Any}}}, NamedTuple{(:a, :b), Tuple{Int64, String}})
Encountered unexpected error in runtime:
AssertionError(msg="invalid `given_argtypes` for `mi`")
va_process_argtypes at ./compiler/inferenceresult.jl:123
InferenceState at ./compiler/inferencestate.jl:314
InferenceState at ./compiler/inferencestate.jl:555
typeinf_edge at ./compiler/typeinfer.jl:796
abstract_call_method at ./compiler/abstractinterpretation.jl:736
infercalls at ./compiler/abstractinterpretation.jl:96
jfptr_infercalls_33787 at /Users/me/.julia/dev/julia/usr/lib/julia/sys.dylib (unknown line)
...
x = 1
x = "23"
(a = 1, b = "23")

julia> Functors.@leaf String  # this isn't the problem

julia> fmap(x -> @show(x), (a=1, b="23"))
Internal error: during type inference of
execute(Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, Main.var"#29#30", typeof(Functors.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, Main.var"#29#30", typeof(Functors.isleaf)}, Base.IdDict{Any, Any}}}, NamedTuple{(:a, :b), Tuple{Int64, String}})
Encountered unexpected error in runtime:
...

(jl_DJAD83) pkg> st
Status `/private/var/folders/yq/4p2zwd614y59gszh7y9ypyhh0000gn/T/jl_DJAD83/Project.toml`
  [d9f16b24] Functors v0.5.0

julia> VERSION
v"1.12.0-DEV.1375"
@CarloLucibello
Copy link
Member

CarloLucibello commented Nov 4, 2024

Additional datapoints:

  • no errors on julia v1.11
  • no errors with fmap(x -> @show(x), (a=1, b="23"), cache=nothing) (VERSION v"1.12.0-DEV.1546")

Maybe we should start worrying when at least an alpha is tagged?
cc @chengchingwen

@mcabbott
Copy link
Member Author

mcabbott commented Nov 4, 2024

Ok, thanks for checking.

I guess this is due to #82?

Maybe this is really a bug report for Base. Can anyone who understands what all Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk are doing suggest how to boil down a minimal example?

@mcabbott mcabbott changed the title Version 0.5 gives errors on strings Version 0.5 gives errors on strings, on Julia 1.12 Nov 4, 2024
@chengchingwen
Copy link
Member

I can also reproduce the error with VERSION v"1.12.0-DEV.1550". I'll try if I can make a MWE without Functors.jl, but it might be hard to fix until v1.12 reach alpha/beta since there are a few compiler changes happening.

@chengchingwen
Copy link
Member

Ok I found the cause and fix. The cause is JuliaLang/julia#54341 that moved the nargs/isva to CodeInfo, so we need to set the value correctly like https://github.com/JuliaDiff/Diffractor.jl/blob/1cbde03541114821539f4de928b9fd39d2f375be/src/stage1/recurse_fwd.jl#L212-L220

@mcabbott
Copy link
Member Author

mcabbott commented Nov 5, 2024

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants