function interfer_test(
obj::T,
Ls::NTuple{2,<:Integer},
) where {T}
CT = complex(T)
mem_init = ntuple(_ -> zeros(CT, Ls), Val(4))
end
@code_warntype interfer_test(1,(100,100))
The above code returns
Variables
#self#::Core.Const(interfer_test)
obj::Int64
Ls::Tuple{Int64, Int64}
#33::var"#33#34"{Tuple{Int64, Int64}, DataType}
mem_init::NTuple{4, Matrix{_A} where _A}
CT::Type{Complex{Int64}}
Body::NTuple{4, Matrix{_A} where _A}
1 ─ (CT = Main.complex($(Expr(:static_parameter, 1))))
│ %2 = Main.:(var"#33#34")::Core.Const(var"#33#34")
│ %3 = Core.typeof(Ls)::Core.Const(Tuple{Int64, Int64})
│ %4 = Core.typeof(CT::Core.Const(Complex{Int64}))::Core.Const(DataType)
│ %5 = Core.apply_type(%2, %3, %4)::Core.Const(var"#33#34"{Tuple{Int64, Int64}, DataType})
│ (#33 = %new(%5, Ls, CT::Core.Const(Complex{Int64})))
│ %7 = #33::var"#33#34"{Tuple{Int64, Int64}, DataType}
│ %8 = Main.Val(4)::Core.Const(Val{4}())
│ %9 = Main.ntuple(%7, %8)::NTuple{4, Matrix{_A} where _A}
│ (mem_init = %9)
└── return %9
It seems the inferred CT
wasn’t transmitted into the anonymous function.
I tried this code on 1.5.1 ,1.6.1 and Master, and the results are similar.