-
Notifications
You must be signed in to change notification settings - Fork 20
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
Update to match Editions behavior of latest protoc (v25.0) #191
Changes from all commits
a50efc8
6be8689
328c392
528a61d
722cf00
824b773
da705da
02e5d5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
24.0-rc2 | ||
25.0-rc2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2025,9 +2025,6 @@ func TestLinkerValidation(t *testing.T) { | |
`, | ||
}, | ||
expectedErr: `test.proto:1:11: edition value "2024" not recognized; should be one of ["2023"]`, | ||
// protoc v24.0-rc2 doesn't (yet?) reject unrecognized editions that | ||
// sort *after* 2023; only ones before 2023 🤷 | ||
expectedDiffWithProtoc: true, | ||
}, | ||
"failure_unknown_edition_past": { | ||
input: map[string]string{ | ||
|
@@ -2041,44 +2038,6 @@ func TestLinkerValidation(t *testing.T) { | |
}, | ||
expectedErr: `test.proto:1:11: edition value "2022" not recognized; should be one of ["2023"]`, | ||
}, | ||
"failure_use_of_features_without_editions": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This moved into the parser's descriptor validation, so is done in parser tests instead of in linker tests. |
||
input: map[string]string{ | ||
"test.proto": ` | ||
syntax = "proto3"; | ||
message Foo { | ||
string foo = 1 [features.field_presence = LEGACY_REQUIRED]; | ||
int32 bar = 2 [features.field_presence = IMPLICIT]; | ||
} | ||
`, | ||
}, | ||
expectedErr: `test.proto:3:25: field Foo.foo: option 'features' may only be used with editions but file uses "proto3" syntax`, | ||
}, | ||
"failure_direct_use_of_raw_features": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no longer a |
||
input: map[string]string{ | ||
"test.proto": ` | ||
edition = "2023"; | ||
message Foo { | ||
string foo = 1 [features.raw_features.field_presence = LEGACY_REQUIRED]; | ||
} | ||
`, | ||
}, | ||
expectedErr: `test.proto:3:34: feature field "raw_features" may not be used explicitly`, | ||
expectedDiffWithProtoc: true, // seems like a bug in protoc that it allows use of raw_features | ||
}, | ||
"failure_direct_use_of_raw_features_in_message_literal": { | ||
input: map[string]string{ | ||
"test.proto": ` | ||
edition = "2023"; | ||
message Foo { | ||
string foo = 1 [features = { | ||
raw_features: <field_presence: IMPLICIT> | ||
}]; | ||
} | ||
`, | ||
}, | ||
expectedErr: `test.proto:4:5: feature field "raw_features" may not be used explicitly`, | ||
expectedDiffWithProtoc: true, // seems like a bug in protoc that it allows use of raw_features | ||
}, | ||
"success_proto2_packed": { | ||
input: map[string]string{ | ||
"test.proto": ` | ||
|
@@ -2250,6 +2209,30 @@ func TestLinkerValidation(t *testing.T) { | |
}, | ||
expectedErr: `test.proto:3:3: packed option is only allowed on repeated fields`, | ||
}, | ||
"failure_editions_feature_on_wrong_target_type": { | ||
input: map[string]string{ | ||
"test.proto": ` | ||
edition = "2023"; | ||
message Foo { | ||
int32 i32 = 1 [features.enum_type=OPEN]; | ||
} | ||
`, | ||
}, | ||
expectedErr: `test.proto:3:18: feature "enum_type" is allowed on [enum,file], not on field`, | ||
}, | ||
"failure_editions_feature_on_wrong_target_type_msg_literal": { | ||
input: map[string]string{ | ||
"test.proto": ` | ||
edition = "2023"; | ||
message Foo { | ||
int32 i32 = 1 [features={ | ||
enum_type: OPEN | ||
}]; | ||
} | ||
`, | ||
}, | ||
expectedErr: `test.proto:4:5: feature "enum_type" is allowed on [enum,file], not on field`, | ||
}, | ||
} | ||
|
||
for name, tc := range testCases { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This latest version of protobuf-go pulls in the latest
descriptor.proto
changes.