Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions base/compiler/ssair/inlining.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,9 @@ end
function analyze_method!(match::MethodMatch, argtypes::Vector{Any},
flag::UInt8, state::InliningState)
method = match.method
methsig = method.sig
spec_types = match.spec_types

# Check that we habe the correct number of arguments
# Check that we have the correct number of arguments
na = Int(method.nargs)
npassedargs = length(argtypes)
if na != npassedargs && !(na > 0 && method.isva)
Expand All @@ -832,6 +832,13 @@ function analyze_method!(match::MethodMatch, argtypes::Vector{Any},
# call this function
return nothing
end
if !match.fully_covers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even when match.fully_covers, spec_types can contain Varargs?

julia> @eval Core.Compiler let
           foo(a...) = length(a)
           matches = _methods_by_ftype(Tuple{typeof(foo),Int,Vararg{Int}}, -1, get_world_counter())
           matches[1]
       end
       
Core.MethodMatch(Tuple{Core.Compiler.var"#foo#431", Int64, Vararg{Int64}}, svec(), (::Core.Compiler.var"#foo#431")(a...) in Core.Compiler at none:2, true)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it fully covers, then we don't need inline the subtyping computation later (which is what failed)

# type-intersection was not able to give us a simple list of types, so
# ir_inline_unionsplit won't be able to deal with inlining this
if !(spec_types isa DataType && length(spec_types.parameters) == length(argtypes) && !isvarargtype(spec_types.parameters[end]))
return nothing
end
end

# Bail out if any static parameters are left as TypeVar
validate_sparams(match.sparams) || return nothing
Expand Down