Skip to content

Commit c46834b

Browse files
authored
follow up #47739 (#47746)
1 parent 7842335 commit c46834b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

base/reflection.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,8 @@ function may_invoke_generator(method::Method, @nospecialize(atype), sparams::Sim
11651165
end
11661166
end
11671167
end
1168-
non_va_args = method.isva ? method.nargs - 1 : method.nargs
1168+
nargs = Int(method.nargs)
1169+
non_va_args = method.isva ? nargs - 1 : nargs
11691170
for i = 1:non_va_args
11701171
if !isdispatchelem(at.parameters[i])
11711172
if (ast_slotflag(code, 1 + i + nsparams) & SLOT_USED) != 0
@@ -1176,7 +1177,7 @@ function may_invoke_generator(method::Method, @nospecialize(atype), sparams::Sim
11761177
if method.isva
11771178
# If the va argument is used, we need to ensure that all arguments that
11781179
# contribute to the va tuple are dispatchelemes
1179-
if (ast_slotflag(code, 1 + method.nargs + nsparams) & SLOT_USED) != 0
1180+
if (ast_slotflag(code, 1 + nargs + nsparams) & SLOT_USED) != 0
11801181
for i = (non_va_args+1):length(at.parameters)
11811182
if !isdispatchelem(at.parameters[i])
11821183
return false

test/staged.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ end
313313
end
314314
g_vararg_generated() = f_vararg_generated((;), (;), Base.inferencebarrier((;)))
315315
let tup = g_vararg_generated()
316-
@test !any(==(Any), tup)
316+
@test all(==(typeof((;))), tup)
317317
# This is just to make sure that the test is actually testing what we want -
318318
# the test only works if there's an unused that matches the position of the
319319
# inferencebarrier argument above (N.B. the generator function itself
320320
# shifts everything over by 1)
321-
@test code_lowered(first(methods(f_vararg_generated)).generator.gen)[1].slotflags[5] == UInt8(0x00)
321+
@test only(code_lowered(only(methods(f_vararg_generated)).generator.gen)).slotflags[5] == UInt8(0x00)
322322
end

0 commit comments

Comments
 (0)