Skip to content

Commit 22b5d93

Browse files
Fix getfield_tfunc for PartialStruct with Vararg (#37769)
Add an `unwrapva` to ensure the returned type is not a `Vararg`.
1 parent 5118121 commit 22b5d93

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/compiler/tfuncs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
809809
nv = fieldindex(widenconst(s), nv, false)
810810
end
811811
if isa(nv, Int) && 1 <= nv <= length(s.fields)
812-
return s.fields[nv]
812+
return unwrapva(s.fields[nv])
813813
end
814814
end
815815
s = widenconst(s)

test/compiler/inference.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,3 +2838,6 @@ f_apply_cglobal(args...) = cglobal(args...)
28382838
@test !Core.Compiler.intrinsic_nothrow(Core.bitcast, Any[Type{Ptr}, Ptr])
28392839
f37532(T, x) = (Core.bitcast(Ptr{T}, x); x)
28402840
@test Base.return_types(f37532, Tuple{Any, Int}) == Any[Int]
2841+
2842+
# issue #37638
2843+
@test !(Core.Compiler.return_type(() -> (nothing, Any[]...)[2], Tuple{}) <: Vararg)

0 commit comments

Comments
 (0)