diff --git a/base/timing.jl b/base/timing.jl index dc4afe48b8a68..6f9a62d11f539 100644 --- a/base/timing.jl +++ b/base/timing.jl @@ -539,6 +539,14 @@ function is_simply_call(@nospecialize ex) Meta.isexpr(a, :..., 1) && is_simple_atom(a.args[1]) && continue return false end + # Ensure Expr(:call, .+, ...) get wrapped + if ex.args[1] isa Symbol + sa = String(ex.args[1]::Symbol) + startswith(sa, ".") && + !endswith(sa, ".") && + isoperator(Symbol(sa[2:end])) && + return false + end return true end diff --git a/test/misc.jl b/test/misc.jl index 7df2d5b725b67..7ccc56db51242 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -1560,6 +1560,9 @@ end @allocated _x = 1+2 @test _x === 3 + # test `@allocated` works for dotted operations + @test (@allocated 1 .+ 1) == 0 + n, m = 10, 20 X = rand(n, m) treshape59278(X, n, m)