Skip to content

Commit ecb8b56

Browse files
authored
fix #24962, bad syntax error for {V) (#25839)
1 parent dedcc75 commit ecb8b56

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/julia-parser.scm

+3-1
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,9 @@
18461846
(error "invalid comprehension syntax")))
18471847
(else
18481848
(if (and (pair? vec) (not (ts:space? s)))
1849-
(error (string "expected separator between arguments to \"[ ]\"; got \""
1849+
(error (string "expected \"" closer "\" or separator in arguments to \""
1850+
(if (eqv? closer #\]) #\[ #\{) " " closer
1851+
"\"; got \""
18501852
(deparse (car vec)) t "\"")))
18511853
(loop (cons (parse-eq* s) vec) outer))))))))
18521854

test/syntax.jl

+3
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,9 @@ end
12391239
@test raw"x \\\ y" == "x \\\\\\ y"
12401240
end
12411241

1242+
@test_throws ParseError("expected \"}\" or separator in arguments to \"{ }\"; got \"V)\"") Meta.parse("f(x::V) where {V) = x")
1243+
@test_throws ParseError("expected \"]\" or separator in arguments to \"[ ]\"; got \"1)\"") Meta.parse("[1)")
1244+
12421245
# issue #9972
12431246
@test Meta.lower(@__MODULE__, :(f(;3))) == Expr(:error, "invalid keyword argument syntax \"3\"")
12441247

0 commit comments

Comments
 (0)