Skip to content

Commit

Permalink
fix #32467, parsing macro on for inside do inside call (#32476)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Jul 3, 2019
1 parent a17d9ae commit b74ef05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@
`(with-bindings ((whitespace-newline #t))
,@body))

(define-macro (without-whitespace-newline . body)
`(with-bindings ((whitespace-newline #f))
,@body))

;; --- lexer ---

(define (newline? c) (eqv? c #\newline))
Expand Down Expand Up @@ -1546,7 +1542,7 @@
(define (parse-do s)
(with-bindings
((expect-end-current-line (input-port-line (ts:port s))))
(without-whitespace-newline
(with-normal-context
(let ((doargs (if (memv (peek-token s) '(#\newline #\;))
'()
(parse-comma-separated s parse-range))))
Expand Down
11 changes: 11 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1867,3 +1867,14 @@ end

@test Meta.lower(Main, :(struct A; A() = new{Int}(); end)) == Expr(:error, "too many type parameters specified in \"new{...}\"")
@test Meta.lower(Main, :(struct A{T, S}; A() = new{Int}(); end)) == Expr(:error, "too few type parameters specified in \"new{...}\"")

# issue #32467
let f = identity(identity() do
x = 0
@inbounds for i = 1:2
x += i
end
x
end)
@test f() == 3
end

0 comments on commit b74ef05

Please sign in to comment.