Skip to content

Commit

Permalink
fix pkgeval
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Aug 2, 2024
1 parent 0b344cc commit c0e388f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,7 @@ function form_partially_defined_struct(@nospecialize(obj), @nospecialize(name))
name isa Const || return nothing
objt0 = widenconst(obj)
objt = unwrap_unionall(objt0)
objt isa DataType || return nothing
isabstracttype(objt) && return nothing
fldidx = try_compute_fieldidx(objt, name.val)
fldidx === nothing && return nothing
Expand Down Expand Up @@ -3109,7 +3110,8 @@ end
@nospecializeinfer function widenreturn_partials(𝕃ᵢ::PartialsLattice, @nospecialize(rt), info::BestguessInfo)
if isa(rt, PartialStruct)
fields = copy(rt.fields)
anyrefine = !isvarargtype(rt.fields[end]) && length(rt.fields) > datatype_min_ninitialized(rt.typ)
anyrefine = !isvarargtype(rt.fields[end]) &&
length(rt.fields) > datatype_min_ninitialized(unwrap_unionall(rt.typ))
𝕃 = typeinf_lattice(info.interp)
= strictpartialorder(𝕃)
for i in 1:length(fields)
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ end
nflds = nfields(sv)
ismod = sv isa Module
elseif isa(s00, PartialStruct)
sty = s00.typ
sty = unwrap_unionall(s00.typ)
nflds = fieldcount_noerror(sty)
ismod = false
else
Expand Down
14 changes: 7 additions & 7 deletions test/tuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ end
@test ntuple(identity, Val(n)) == ntuple(identity, n)
end

@test Core.Compiler.return_type(ntuple, Tuple{typeof(identity), Val}) == Tuple{Vararg{Int}}
@test Base.infer_return_type(ntuple, Tuple{typeof(identity), Val}) == Tuple{Vararg{Int}}
end

struct A_15703{N}
Expand Down Expand Up @@ -835,8 +835,8 @@ end
@test @inferred(Base.circshift(t3, 7)) == ('b', 'c', 'd', 'a')
@test @inferred(Base.circshift(t3, -1)) == ('b', 'c', 'd', 'a')
@test_throws MethodError circshift(t1, 'a')
@test Core.Compiler.return_type(circshift, Tuple{Tuple,Integer}) <: Tuple
@test Core.Compiler.return_type(circshift, Tuple{Tuple{Vararg{Any,10}},Integer}) <: Tuple{Vararg{Any,10}}
@test Base.infer_return_type(circshift, Tuple{Tuple,Integer}) <: Tuple
@test Base.infer_return_type(circshift, Tuple{Tuple{Vararg{Any,10}},Integer}) <: Tuple{Vararg{Any,10}}
for len 0:5
v = 1:len
t = Tuple(v)
Expand All @@ -847,8 +847,8 @@ end
end

@testset "abstract return type inference for homogeneous tuples" begin
@test NTuple == Core.Compiler.return_type(Base.tail, Tuple{NTuple})
@test NTuple == Core.Compiler.return_type(Base.front, Tuple{NTuple})
@test NTuple == Core.Compiler.return_type(reverse, Tuple{NTuple})
@test NTuple == Core.Compiler.return_type(circshift, Tuple{NTuple,Int})
@test NTuple == Base.infer_return_type(Base.tail, Tuple{NTuple})
@test NTuple == Base.infer_return_type(Base.front, Tuple{NTuple})
@test NTuple == Base.infer_return_type(reverse, Tuple{NTuple})
@test NTuple == Base.infer_return_type(circshift, Tuple{NTuple,Int})
end

0 comments on commit c0e388f

Please sign in to comment.