diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 3c37a6a9f8759..f762753a5f80f 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -1695,7 +1695,7 @@ (expand-forms `(call (top broadcast!) ,(from-lambda (cadr e)) ,lhs-view ,@(caddr e)))) (if (null? lhs) (expand-forms e) - (expand-forms `(call (top broadcast!) identity ,lhs-view ,e)))))) + (expand-forms `(call (top broadcast!) (top identity) ,lhs-view ,e)))))) ;; table mapping expression head to a function expanding that form (define expand-table diff --git a/test/broadcast.jl b/test/broadcast.jl index 7cc1ceffa500f..dfbbeed1c8950 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -284,6 +284,10 @@ let d = Dict(:foo => [1,3,7], (3,4) => [5,9]) d[3,4] .-= 1 @test d[3,4] == [4,8] end +let identity = error, x = [1,2,3] + x .= 1 # make sure it goes to broadcast!(Base.identity, ...), not identity + @test x == [1,1,1] +end # PR 16988 @test Base.promote_op(+, Bool) === Int