julia> y = Array{Float64}(undef, 2, 2); @. y =rand(2,2) + ones(2,2)
ERROR: MethodError: Cannot `convert` an object of type Array{Float64,2} to an object of type Float64
Where is the attempted conversion? Moving @. to after the assignment operator works fine, as does pre-allocating the two matrices.
Incidentally, when trying to debug code with macros, @macroexpand (or @macroexpand1) is handy.
It probably would have allowed you to find the problem in this case:
Allocating a 2x2 temporary array just to discard it is also slow; it’s a tradeoff. In general, I would err on the side of fewer temporary arrays and more readable code.