Skip to content

Commit

Permalink
fix #41253, parse error in function (::T{}) (#41259)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Jun 18, 2021
1 parent fb67607 commit dc2befc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,8 @@
(define (valid-1arg-func-sig? sig)
(or (symbol? sig)
(and (pair? sig) (eq? (car sig) '|::|)
(symbol? (cadr sig)))))
(or (symbol? (cadr sig))
(length= sig 2)))))

(define (unwrap-where x)
(if (and (pair? x) (eq? (car x) 'where))
Expand Down Expand Up @@ -1469,7 +1470,9 @@
;; function foo => syntax error
(error (string "expected \"(\" in " word " definition")))
(if (not (valid-func-sig? paren sig))
(error (string "expected \"(\" in " word " definition"))
(if paren
(error (string "ambiguous signature in " word " definition. Try adding a comma if this is a 1-argument anonymous function."))
(error (string "expected \"(\" in " word " definition")))
sig)))
(body (parse-block s)))
(expect-end s word)
Expand Down
3 changes: 3 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2927,3 +2927,6 @@ b'` == `$("a\\\nb")`
\\
``` == `'\'`
end

# issue #41253
@test (function (::Dict{}); end)(Dict()) === nothing

0 comments on commit dc2befc

Please sign in to comment.