It does not look like this was ever posted in the github tracker. 

kl. 17:33:37 UTC+2 onsdag 28. mai 2014 skrev Jameson følgende:
>
> Looks like a code lowering bug. Can you post this to the github issue 
> tracker?
>
> On Wednesday, May 28, 2014, Adam Kapor <[email protected] <javascript:>> 
> wrote:
>
>> I'm not sure what :(::) is supposed to do below, but not giving an error 
>> at top level suggests to me that x[1] is "an expression computing a value." 
>> In any case, I was surprised that += runs but doesn't `setindex!` x
>>
>>
>> julia> x=zeros(2)
>> 2-element Array{Float64,1}:
>>  0.0
>>  0.0
>> julia> x[1]::Float64 += 1.
>> 1.0
>> julia> x
>> 2-element Array{Float64,1}:
>>  0.0
>>  0.0
>> julia> x[1]::Float64 = 1.
>> ERROR: syntax: invalid assignment location "x[1]"
>>
>> julia> myf(x) = x[1]::Float64+=1
>> myf (generic function with 1 method)
>> julia> code_lowered(myf,(Array,))
>> 1-element Array{Any,1}:
>>  :($(Expr(:lambda, {:x}, 
>> {{:#s36,:#s40},{{:x,:Any,0},{:#s36,:Any,18},{:#s40,:Float64,2}},{}}, 
>> :(begin  # none, line 1:
>>         #s40 = 
>> top(typeassert)(top(convert)(Float64,getindex(x,1)),Float64)
>>         #s36 = top(typeassert)(#s40,Float64) + 1
>>         #s40 = top(typeassert)(top(convert)(Float64,#s36),Float64)
>>         return #s36
>>     end))))
>> julia> myf_noassert(x) = x[1]+=1
>> myf_noassert (generic function with 1 method)
>> julia> code_lowered(myf_noassert, (Array,))
>> 1-element Array{Any,1}:
>>  :($(Expr(:lambda, {:x}, {{:#s30},{{:x,:Any,0},{:#s30,:Any,18}},{}}, 
>> :(begin  # none, line 1:
>>         #s30 = getindex(x,1) + 1
>>         setindex!(x,#s30,1)
>>         return #s30
>>     end))))
>>
>> 

Reply via email to