Skip to content

fix: reserved field inside group blocks fail parsing #2058

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

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
4 changes: 4 additions & 0 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ function parse(source, root, options) {
parseEnum(type, token);
break;

case "reserved":
readRanges(type.reserved || (type.reserved = []), true);
break;

/* istanbul ignore next */
default:
throw illegal(token); // there are no groups with proto3 semantics
Expand Down
8 changes: 8 additions & 0 deletions tests/data/uncommon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ service Test6 { option (custom).bar = "";
rpc DoSomethingElse( stream DoSomethingRequest ) returns (DoSomethingResponse); /// post
rpc DoSomethingEntirelyDifferent(DoSomethingRequest ) returns ( stream DoSomethingResponse ); /// post
};

message Test7 {
repeated group RepeatedGroup = 1 {
optional string id = 2;
reserved 3;
optional string info = 4;
}
}