Skip to content

Commit

Permalink
Revert "Test that `next' is only used inside a decorator."
Browse files Browse the repository at this point in the history
This reverts commit 728fa84.

Testing that the fuzz regression steps picks up the error.

Issue #265
  • Loading branch information
Jamie Wilkinson committed Aug 27, 2019
1 parent 0176e2c commit 20e1c81
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
9 changes: 1 addition & 8 deletions internal/vm/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,11 @@ func (c *checker) VisitAfter(node ast.Node) ast.Node {
return n

case *ast.NextStmt:
// The last element in this list will be the empty stack created by the
// DecoDecl on the way in. If there's no last element, then we can't
// have entered a DecoDecl yet.
// The last element in this list will be the empty stack created by the DecoDecl on the way in.
last := len(c.decoScopes) - 1
if last < 0 {
c.errors.Add(n.Pos(), fmt.Sprintf("Can't use `next' outside of a decorator."))
return n
}
decoScope := c.decoScopes[last]
if len(decoScope.Symbols) > 0 {
c.errors.Add(n.Pos(), fmt.Sprintf("Can't use `next' statement twice in a decorator."))
return n
}
// Merge the current scope into it.
decoScope.CopyFrom(c.scope)
Expand Down
10 changes: 0 additions & 10 deletions internal/vm/checker/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,6 @@ const ID /bar/
foo = $1
}`,
[]string{"counter with buckets:1:9-11: Can't specify buckets for non-histogram metric `foo'."}},

{"next outside of decorator",
`def x{
next
}
@x {
next
}
`,
[]string{"next outside of decorator:5:1-4: Can't use `next' outside of a decorator."}},
}

func TestCheckInvalidPrograms(t *testing.T) {
Expand Down

0 comments on commit 20e1c81

Please sign in to comment.