diff --git a/src/ast.scm b/src/ast.scm index d5016348c73c8..f5910933fc9c8 100644 --- a/src/ast.scm +++ b/src/ast.scm @@ -179,6 +179,13 @@ "")) "") (string.rep " " ilvl) "end")) + ((do) + (let ((call (cadr e)) + (args (cdr (cadr (caddr e)))) + (body (caddr (caddr e)))) + (deparse-block (string (deparse call) " do" (if (null? args) "" " ") + (deparse-arglist args)) + (cdr body) ilvl))) ((struct) (string (if (eq? (cadr e) 'true) "mutable " "") "struct " diff --git a/test/syntax.jl b/test/syntax.jl index d8e2c96674cda..9f9f0d9687dde 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -1386,3 +1386,23 @@ end # issue #26717 @test Meta.lower(@__MODULE__, :( :(:) = 2 )) == Expr(:error, "invalid assignment location \":(:)\"") + +# issue #17781 +let ex = Meta.lower(@__MODULE__, Meta.parse(" + A = function (s, o...) + f(a, b) do + end + end, + B = function (s, o...) + f(a, b) do + end + end")) + @test isa(ex, Expr) && ex.head === :error + @test ex.args[1] == """ +invalid assignment location "function (s, o...) + # none, line 3 + f(a, b) do + # none, line 4 + end +end\"""" +end