Skip to content

Commit

Permalink
Fix getfield_tfunc for PartialStruct with Vararg (#37769)
Browse files Browse the repository at this point in the history
Add an `unwrapva` to ensure the returned type is not a `Vararg`.
  • Loading branch information
martinholters authored Sep 28, 2020
1 parent 5118121 commit 22b5d93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
nv = fieldindex(widenconst(s), nv, false)
end
if isa(nv, Int) && 1 <= nv <= length(s.fields)
return s.fields[nv]
return unwrapva(s.fields[nv])
end
end
s = widenconst(s)
Expand Down
3 changes: 3 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2838,3 +2838,6 @@ f_apply_cglobal(args...) = cglobal(args...)
@test !Core.Compiler.intrinsic_nothrow(Core.bitcast, Any[Type{Ptr}, Ptr])
f37532(T, x) = (Core.bitcast(Ptr{T}, x); x)
@test Base.return_types(f37532, Tuple{Any, Int}) == Any[Int]

# issue #37638
@test !(Core.Compiler.return_type(() -> (nothing, Any[]...)[2], Tuple{}) <: Vararg)

2 comments on commit 22b5d93

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.