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

fix Vararg{T,T} where T crashing code_typed #56081

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,13 @@ function collect_slot_refinements(𝕃ᵢ::AbstractLattice, applicable::Vector{A
sigt = Bottom
for j = 1:length(applicable)
match = applicable[j]::MethodMatch
simeonschaub marked this conversation as resolved.
Show resolved Hide resolved
sigt = sigt ⊔ fieldtype(match.spec_types, i)
spect = fieldtype(match.spec_types, i)
if isType(spect)
simeonschaub marked this conversation as resolved.
Show resolved Hide resolved
sigt = sigt ⊔ spect
else
sigt = Any
break
end
end
if sigt ⊏ argt # i.e. signature type is strictly more specific than the type of the argument slot
if slotrefinements === nothing
Expand Down
7 changes: 7 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6048,3 +6048,10 @@ t255751 = Array{Float32, 3}

issue55882_nfields(x::Union{T,Nothing}) where T<:Number = nfields(x)
@test Base.infer_return_type(issue55882_nfields) <: Int

# issue #55916
f55916(x) = 1
f55916(::Vararg{T,T}) where {T} = "2"
g55916(x) = f55916(x)
# this shouldn't error
@test only(code_typed(g55916, (Any,); optimize=false))[2] == Int