diff --git a/NEWS.md b/NEWS.md index c219828398ccae..40420b2899a1fc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,6 +32,8 @@ Language changes (in addition to the one that enters the help mode) to see the full docstring. ([#25930]) +* The syntax `(;)` (which was deprecated in v1.4) now creates an empty named tuple ([#30115]). + Multi-threading changes ----------------------- diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 28e6146fdcf61f..4ec5b55bd41595 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1921,9 +1921,7 @@ (and (null? first) (null? blk) ;; all semicolons inside () (if (length= (car args) 1) - (begin (parser-depwarn s "(;)" "begin end") - ;; should eventually be (tuple (parameters)) - `(block)) + `(tuple (parameters)) `(block))))))) (and (null? first) (null? args) (not comma?) (error "unreachable")) diff --git a/test/syntax.jl b/test/syntax.jl index f807415ce5cbdb..82baf7ed3be0ea 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -171,7 +171,7 @@ macro test999_str(args...); args; end # blocks vs. tuples @test Meta.parse("()") == Expr(:tuple) -@test_skip Meta.parse("(;)") == Expr(:tuple, Expr(:parameters)) +@test Meta.parse("(;)") == Expr(:tuple, Expr(:parameters)) @test Meta.parse("(;;;;)") == Expr(:block) @test_throws ParseError Meta.parse("(,)") @test_throws ParseError Meta.parse("(;,)") @@ -1322,7 +1322,7 @@ end @test Meta.parse("-(x)^2") == Expr(:call, :-, Expr(:call, :^, :x, 2)) @test Meta.parse("-(a=1)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:(=), :a, 1), 2)) @test Meta.parse("-(x;y)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:block, :x, LineNumberNode(1,:none), :y), 2)) -@test_skip Meta.parse("-(;)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:tuple, Expr(:parameters)), 2)) +@test Meta.parse("-(;)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:tuple, Expr(:parameters)), 2)) @test Meta.parse("-(;;;;)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:block), 2)) @test Meta.parse("-(x;;;)^2") == Expr(:call, :-, Expr(:call, :^, Expr(:block, :x), 2)) @test Meta.parse("+((1,2))") == Expr(:call, :+, Expr(:tuple, 1, 2))