Skip to content

Commit

Permalink
syntax: deparse function end (#44630)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Mar 21, 2022
1 parent 28f58e7 commit 1eae65b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
(cdr e)
(list e)))
(deparse-block (string (car e) " " (deparse (cadr e)))
(block-stmts (caddr e))
(if (null? (cddr e)) '() (block-stmts (caddr e)))
ilvl))
((return) (string "return " (deparse (cadr e))))
((break continue) (string (car e)))
Expand Down
8 changes: 8 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,14 @@ invalid assignment location "function (s, o...)
end\""""
end

let ex = Meta.lower(@__MODULE__, :(function g end = 1))
@test isa(ex, Expr) && ex.head === :error
@test ex.args[1] == """
invalid assignment location "function g
end\""""
end


# issue #15229
@test Meta.lower(@__MODULE__, :(function f(x); local x; 0; end)) ==
Expr(:error, "local variable name \"x\" conflicts with an argument")
Expand Down

0 comments on commit 1eae65b

Please sign in to comment.