`code_warntype` understanding

Yes. The OP hadn’t posted a minimal example yet, so I commented with an example illustrating the issue. I think new users can miss the fact that just because something looks like a function, doesn’t mean it is a constant.

A simpler example would have been

model = x -> 3x
@code_warntype model(6)
modelcall() = model(7)
@code_warntype modelcall()

but I figured @misha_mikhasenko’s example may look more similar to the struct definition with an added call method, and seeing the example would help confirm/deny that this is what is going on.

1 Like