Skip to content

Commit 2b647ab

Browse files
authored
Fix inline io parsing with mixins (#1756)
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.
1 parent 11fee39 commit 2b647ab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlModelLoader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,6 @@ private void parseInlineableOperationMember(
10831083
}
10841084
// Remove any pending, invalid docs that may have come before the inline shape.
10851085
tokenizer.removePendingDocCommentLines();
1086-
tokenizer.next();
10871086
// don't skip docs here in case there are docs on the inlined structure.
10881087
tokenizer.skipWs();
10891088
consumer.accept(parseInlineStructure(id.getName() + suffix, defaultTrait));

smithy-model/src/test/resources/software/amazon/smithy/model/loader/valid/inline-io/inline-io.smithy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ structure NameBearer {
3030
}
3131

3232
operation UsesMixins {
33-
input := with [NameBearer] {
33+
// Parser handles weird/missing SP
34+
input :=with [NameBearer] {
3435
id: String
3536
}
3637

0 commit comments

Comments
 (0)