@@ -412,8 +412,12 @@ function translate!!(var::IRVar, line::Expr,
412412 bindings:: Bindings , isconst:: Bool , ir:: Core.CodeInfo )
413413 head = line. head
414414 _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
415419 if head === :new
416- args = map (_bind_fn, line. args)
420+ args = map (_bind_fn ∘ _expand_sp , line. args)
417421 return Instruction (__new__, args |> Tuple, _bind_fn (var))
418422 elseif head === :call
419423 # 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,
423427 v = ir. ssavaluetypes[var. id]. val
424428 _canbeoptimized (v) && return _const_instruction (var, v, bindings, ir)
425429 end
426- args = map (_bind_fn, line. args)
430+ args = map (_bind_fn ∘ _expand_sp , line. args)
427431 # args[1] is the function
428432 func = line. args[1 ]
429433 if Meta. isexpr (func, :static_parameter ) # func is a type parameter
0 commit comments