@@ -412,8 +412,12 @@ function translate!!(var::IRVar, line::Expr,
412
412
bindings:: Bindings , isconst:: Bool , ir:: Core.CodeInfo )
413
413
head = line. head
414
414
_bind_fn = (x) -> bind_var! (x, bindings, ir)
415
+ # expand static parameter
416
+ _expand_sp = (x) -> begin
417
+ Meta. isexpr (x, :static_parameter ) ? ir. parent. sparam_vals[x. args[1 ]] : x
418
+ end
415
419
if head === :new
416
- args = map (_bind_fn, line. args)
420
+ args = map (_bind_fn ∘ _expand_sp , line. args)
417
421
return Instruction (__new__, args |> Tuple, _bind_fn (var))
418
422
elseif head === :call
419
423
# Only some of the function calls can be optimized even though many of their results are
@@ -423,7 +427,7 @@ function translate!!(var::IRVar, line::Expr,
423
427
v = ir. ssavaluetypes[var. id]. val
424
428
_canbeoptimized (v) && return _const_instruction (var, v, bindings, ir)
425
429
end
426
- args = map (_bind_fn, line. args)
430
+ args = map (_bind_fn ∘ _expand_sp , line. args)
427
431
# args[1] is the function
428
432
func = line. args[1 ]
429
433
if Meta. isexpr (func, :static_parameter ) # func is a type parameter
0 commit comments