Could anybody please help me improve my understanding of what looks like strange behavior?

function good1(x::Array{T,1}) where T<:Float64
n = length(x)
x *= 1 # problem is not here
[i for i in x]
end
function good2(x::Array{T,1}) where T<:Float64
n = length(x)
[x[i] for i in 1:n] # problem is not here
end
function wrong(x::Array{T,1}) where T<:Float64
n = length(x)
x *= 1
[x[i] for i in 1:n]
end
@code_warntype good1([0.])
@code_warntype good2([0.])
@code_warntype wrong([0.]) # also n is interpreted as Any here!

Looks like something goes wrong. Somewhat simplified:

function f(x)
return [x[i] for i = 1:length(x)]
end
function g(x)
x = x
return [x[i] for i = 1:length(x)]
end
@code_warntype f([0])
@code_warntype g([0])