Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1441 #1442

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/arr/compiler/well-formed.arr
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,11 @@ well-formed-visitor = A.default-iter-visitor.{
end
end,
method s-user-block(self, l :: Loc, body :: A.Expr) block:
old-pbl = parent-block-loc
parent-block-loc := l
body.visit(self)
ans = body.visit(self)
parent-block-loc := old-pbl
ans
end,
method s-tuple-bind(self, l, fields, as-name) block:
true
Expand Down Expand Up @@ -852,10 +855,14 @@ well-formed-visitor = A.default-iter-visitor.{
ans
end,
method s-for(self, l, iterator, bindings, ann, body, blocky) block:
old-pbl = parent-block-loc
parent-block-loc := l
when not(blocky):
wf-blocky-blocks(l, [list: body])
end
iterator.visit(self) and lists.all(_.visit(self), bindings) and ann.visit(self) and body.visit(self)
ans = iterator.visit(self) and lists.all(_.visit(self), bindings) and ann.visit(self) and body.visit(self)
parent-block-loc := old-pbl
ans
end,
method s-frac(self, l, num, den) block:
when den == 0:
Expand Down
2 changes: 2 additions & 0 deletions tests/pyret/tests/test-well-formed.arr
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ check "malformed blocks":
"10")
satisfies CS.is-block-needed

c("for map(): end") satisfies CS.is-wf-empty-block

run-str("lam(): x = 5 end") is%(output) compile-error(CS.is-block-ending)
run-str("lam(): var x = 5 end") is%(output) compile-error(CS.is-block-ending)
run-str("lam(): fun f(): nothing end end") is%(output) compile-error(CS.is-block-ending)
Expand Down