diff --git a/NEWS.md b/NEWS.md index 905888015b1f1..3ce11e7fe2c25 100644 --- a/NEWS.md +++ b/NEWS.md @@ -47,6 +47,8 @@ New language features * Keyword arguments can be required: if a default value is omitted, then an exception is thrown if the caller does not assign the keyword a value ([#25830]). + * The pair operator `=>` is now broadcastable as `.=>` which was previously a parsing error ([#27447]) + Language changes ---------------- diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 5629281852624..c48793615da3a 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -10,7 +10,7 @@ (append! (add-dots '(= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>= |\|=| &= ⊻= ≔ ⩴ ≕)) '(:= ~ $=))) ;; comma - higher than assignment outside parentheses, lower when inside -(define prec-pair '(=>)) +(define prec-pair (add-dots '(=>))) (define prec-conditional '(?)) (define prec-arrow (append! '(-- -->) diff --git a/test/broadcast.jl b/test/broadcast.jl index 28fe64e87cb8a..497644409ee4e 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -727,6 +727,13 @@ let f(args...) = *(args...) @test f.(x..., f.(x..., y, z...), y, z...) == broadcast(f, x..., broadcast(f, x..., y, z...), y, z...) == 120*120 end +# Issue #27446: Broadcasting pair operator +let + c = ["foo", "bar"] + d = [1,2] + @test Dict(c .=> d) == Dict("foo" => 1, "bar" => 2) +end + # Broadcasted iterable/indexable APIs let bc = Broadcast.instantiate(Broadcast.broadcasted(+, zeros(5), 5))