Skip to content

Commit

Permalink
put back broadcast behavior with repeated indices, changed by #31300
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 18, 2019
1 parent 4a38e79 commit 9fd7b93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1444,10 +1444,8 @@
(define (expand-update-operator- op op= lhs rhs declT)
(let* ((e (remove-argument-side-effects lhs))
(newlhs (car e))
(temp (and (eq? op= '|.=|) (pair? newlhs) (make-ssavalue)))
(newlhs (if (and temp (eq? (car newlhs) 'ref))
(ref-to-view newlhs)
newlhs))
(temp (and (eq? op= '|.=|) (pair? newlhs) (not (eq? (car newlhs) 'ref))
(make-ssavalue)))
(e (if temp
(cons temp (append (cdr e) (list `(= ,temp ,newlhs))))
e))
Expand Down
4 changes: 4 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,4 +817,8 @@ end
let a = rand(5), b = rand(5), c = copy(a)
view(identity(a), 1:3) .+= view(b, 1:3)
@test a == [(c+b)[1:3]; c[4:5]]

x = [1]
x[[1,1]] .+= 1
@test x == [2]
end

0 comments on commit 9fd7b93

Please sign in to comment.