Why does println break @generated functions?

I’m trying to debug JLD2, but can’t find the line that breaks.

I think it’s somewhere in a @generated function, but adding println’s to it breaks everything.

i.e. I get this error message:

task switch not allowed from inside staged nor pure functions

The function in question is:

And a relevant gif is:

Use Core.print.

2 Likes

Thanks @kristoffer.carlsson!

Do you know why Core.println doesn’t work anymore?

// gonna link to this on the relevant github issue for future lost souls

edit: ignore this. had a typo that prevented a revise reload

It should.

julia> @generated function f(a)
           Core.println(a)
           nothing
       end
f (generic function with 1 method)

julia> f(1)
Int64
1 Like