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

Inference-related internal method error during testing of StructWalk.jl #52613

Closed
maleadt opened this issue Dec 22, 2023 · 3 comments · Fixed by #52721
Closed

Inference-related internal method error during testing of StructWalk.jl #52613

maleadt opened this issue Dec 22, 2023 · 3 comments · Fixed by #52721
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version
Milestone

Comments

@maleadt
Copy link
Member

maleadt commented Dec 22, 2023

Bisected to #50927; cc @vtjnash

As seen on PkgEval, during testing of StructWalk.jl:

Internal error: encountered unexpected error in runtime:
MethodError(f=Core.Compiler.:(⊑), args=(Core.Compiler.JLTypeLattice(), Vararg{Any}, Symbol), world=0x00000000000015e9)
jl_method_error_bare at /source/src/gf.c:2206
jl_method_error at /source/src/gf.c:2224
jl_lookup_generic_ at /source/src/gf.c:3055 [inlined]
ijl_apply_generic at /source/src/gf.c:3070
⊑ at ./compiler/typelattice.jl:530
⊑ at ./compiler/typelattice.jl:508
⊑ at ./compiler/typelattice.jl:432 [inlined]
⊑ at ./compiler/typelattice.jl:397
#348 at ./compiler/abstractlattice.jl:286 [inlined]
typevar_nothrow at ./compiler/tfuncs.jl:608 [inlined]
_builtin_nothrow at ./compiler/tfuncs.jl:2123
builtin_nothrow at ./compiler/tfuncs.jl:2463 [inlined]
builtin_effects at ./compiler/tfuncs.jl:2448
@maleadt maleadt added regression Regression in behavior compared to a previous version compiler:inference Type inference labels Dec 22, 2023
@maleadt maleadt added this to the 1.11 milestone Dec 22, 2023
@Keno
Copy link
Member

Keno commented Dec 22, 2023

Something is leaking Vararg, but _builtin_nothrow does check, so it's something slightly more involved.

@maleadt
Copy link
Member Author

maleadt commented Dec 22, 2023

MWE:

function getfields(obj::T) where T
    fnames = fieldnames(T)
    getfield.(Ref(obj), fnames)
end
function walk(f, WALKSTYLE, inner_walk, x)
    T, fields = typeof(x), getfields(x)
    map(inner_walk, fields)
    T(v...)
end
mapleaves(_, x) = walk(f, style, x -> mapleaves(fstyle, x), x)
mapleaves() = mapleaves(f, Ref)
mapleaves()
julia> mapleaves()
Internal error: encountered unexpected error in runtime:
MethodError(f=Core.Compiler.:(⊑), args=(Core.Compiler.JLTypeLattice(), Vararg{Any}, Symbol), world=0x00000000000016b2)
jl_method_error_bare at /home/tim/Julia/src/julia/src/gf.c:2215
jl_method_error at /home/tim/Julia/src/julia/src/gf.c:2233
jl_lookup_generic_ at /home/tim/Julia/src/julia/src/gf.c:3078 [inlined]
ijl_apply_generic at /home/tim/Julia/src/julia/src/gf.c:3093
⊑ at ./compiler/typelattice.jl:530
⊑ at ./compiler/typelattice.jl:508
⊑ at ./compiler/typelattice.jl:432 [inlined]
⊑ at ./compiler/typelattice.jl:397
#368 at ./compiler/abstractlattice.jl:288 [inlined]
typevar_nothrow at ./compiler/tfuncs.jl:613 [inlined]
_builtin_nothrow at ./compiler/tfuncs.jl:2180
builtin_nothrow at ./compiler/tfuncs.jl:2605 [inlined]
builtin_effects at ./compiler/tfuncs.jl:2523

@vtjnash
Copy link
Member

vtjnash commented Dec 23, 2023

Aka:

julia> code_typed((Any,)) do x; TypeVar(x...); end
ERROR: MethodError: no method matching (::Core.Compiler.JLTypeLattice, ::Core.TypeofVararg, ::Type{Symbol})

Keno added a commit that referenced this issue Jan 3, 2024
Fix #52613 by making the TypeVar special case in inference check
for vararg first. There's nothing the special case can really do
with vararg anyway, so fall back to the ordinary abstract call
handling.
aviatesk pushed a commit that referenced this issue Jan 4, 2024
Fix #52613 by making the TypeVar special case in inference check
for vararg first. There's nothing the special case can really do
with vararg anyway, so fall back to the ordinary abstract call
handling.
aviatesk pushed a commit that referenced this issue Jan 4, 2024
Fix #52613 by making the TypeVar special case in inference check for
vararg first. There's nothing the special case can really do with vararg
anyway, so fall back to the ordinary abstract call handling.
aviatesk pushed a commit that referenced this issue Jan 5, 2024
Fix #52613 by making the TypeVar special case in inference check for
vararg first. There's nothing the special case can really do with vararg
anyway, so fall back to the ordinary abstract call handling.
KristofferC pushed a commit that referenced this issue Jan 5, 2024
Fix #52613 by making the TypeVar special case in inference check for
vararg first. There's nothing the special case can really do with vararg
anyway, so fall back to the ordinary abstract call handling.
aviatesk pushed a commit that referenced this issue Jan 6, 2024
Fix #52613 by making the TypeVar special case in inference check for
vararg first. There's nothing the special case can really do with vararg
anyway, so fall back to the ordinary abstract call handling.
Drvi pushed a commit to RelationalAI/julia that referenced this issue Jun 7, 2024
Fix JuliaLang#52613 by making the TypeVar special case in inference check for
vararg first. There's nothing the special case can really do with vararg
anyway, so fall back to the ordinary abstract call handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants