Skip to content

Commit

Permalink
Fix inline io parsing with mixins (#1756)
Browse files Browse the repository at this point in the history
When there was no space between the `:=` and `with` tokens when
parsing an inline io statement, for example:
```
operation Foo {
  input :=with [Bar] {}
}
```
the parser would skip the `with` and so not realize its parsing a
mixin, failing when it sees a `[` instead of a `{`. This was due
to an extra call to `tokenizer.next()`, which skipped the `with`.
Usually the `next()` would just skip the space before the `with`,
but when the space wasn't present it skipped the `with`.

The inline-io test was updated to include this case.
  • Loading branch information
milesziemer authored Apr 27, 2023
1 parent 11fee39 commit 2b647ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,6 @@ private void parseInlineableOperationMember(
}
// Remove any pending, invalid docs that may have come before the inline shape.
tokenizer.removePendingDocCommentLines();
tokenizer.next();
// don't skip docs here in case there are docs on the inlined structure.
tokenizer.skipWs();
consumer.accept(parseInlineStructure(id.getName() + suffix, defaultTrait));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ structure NameBearer {
}

operation UsesMixins {
input := with [NameBearer] {
// Parser handles weird/missing SP
input :=with [NameBearer] {
id: String
}

Expand Down

0 comments on commit 2b647ab

Please sign in to comment.