Commit Graph

660 Commits

Author SHA1 Message Date
Jan Tattermusch
dd013bdf06 regenerate protos 2020-05-11 11:18:49 +02:00
Jan Tattermusch
661c0c4eb8 add tests for selfreferential options 2020-05-11 11:18:49 +02:00
Jan Tattermusch
bf3eef94c1
Merge pull request #7434 from jtattermusch/csharp_expose_options
C#: Get rid of broken GetOption API and expose the "GetOptions()" method on descriptors instead
2020-05-11 09:40:51 +02:00
Jon Skeet
6b0ff74ecf Implement HasPresence for C#
FieldDescriptor.HasPresence returns true if both ClearValue and HasValue (on the accessor) can be expected to work. Some fields have a working ClearValue, but no HasValue; HasPresence returns false for those fields.

Generally:

- Extension fields have presence if and only if they're singular
- Repeated fields do not support presence
- Map fields do not support presence
- Message fields support presence
- Oneof fields support presence (this includes synthetic oneof fields, so that covers proto3 optional singular fields)
- Proto2 singular primitive fields support presence
- Proto3 singular primitive fields do not support presence (unless they're in a oneof, covered above)
2020-05-08 06:17:50 +01:00
Joshua Haberman
2d80a70048 Sync from Piper @310457838
PROTOBUF_SYNC_PIPER
2020-05-07 16:21:50 -07:00
Jan Tattermusch
0688883b52 address review comments 2020-05-06 18:53:36 +02:00
Joshua Haberman
2ac29ae5d4 Sync from Piper @310014675
PROTOBUF_SYNC_PIPER
2020-05-05 13:56:07 -07:00
Jan Tattermusch
a690227398
Merge pull request #7351 from jtattermusch/protobuf_csharp_new_parsing
New Span-based C# parsing logic
2020-05-05 16:57:52 +02:00
Joshua Haberman
c05b55880f Sync from Piper @309848308
PROTOBUF_SYNC_PIPER
2020-05-04 17:10:15 -07:00
Jon Skeet
ed5c874de3 Fix to C# support library code
(This was the only use of a HasXyz property for a message type.)
2020-05-01 09:06:44 +01:00
Jon Skeet
9926c9504b Regenerate C# code based on the previous commit
(This removes the Has/Clear members for message types in proto2.)
2020-05-01 09:06:44 +01:00
Jan Tattermusch
ff999c9d42 clarify docs 2020-04-29 08:57:53 +02:00
Jan Tattermusch
673245f212 remove unnecessary cast 2020-04-29 08:50:59 +02:00
Jan Tattermusch
402ce8b17f add back GetOption tests 2020-04-28 19:25:06 +02:00
Jan Tattermusch
062c2dc24b add back GetOption methods, but mark them as obsolete 2020-04-28 19:14:27 +02:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Jan Tattermusch
f4ff22026b add a few more tests 2020-04-28 13:59:54 +02:00
Jan Tattermusch
9720ae41c2 adjust CustomOptionsTest.cs 2020-04-28 12:49:29 +02:00
Jan Tattermusch
944055a683 expose Options property on descriptors 2020-04-28 10:49:49 +02:00
Jan Tattermusch
7134d25eb8 Merge remote-tracking branch 'upstream/master' into protobuf_csharp_new_parsing 2020-04-27 13:18:07 +02:00
Jon Skeet
97737072f9 Add reflection support for proto3 optional fields
This is more involved than might be expected because the synthetic oneofs don't generate the properties we would usually expect to see.
2020-04-24 17:39:14 +01:00
Jon Skeet
bad9d753ae Add unit tests for proto3 optional fields
(This isn't as exhaustive as it might be, but the behavior is basically the same as proto2 optional fields.)
2020-04-24 17:39:14 +01:00
Jon Skeet
b0649a088a Regenerate C# code with the new generator, adding unittest_proto3_optional.proto
The changes in the existing proto2 code are solely around presence bits. The new generator allocated presence bits more efficiently. (Previously bits were sometimes allocated but never used.)
2020-04-24 17:39:14 +01:00
Jan Tattermusch
a1b9aa499e get rid of extraneous ParserInternalState.codedInputStream field 2020-04-23 16:58:59 +02:00
Jan Tattermusch
eb38a3cdb8 adjust some TODOs in ParsingPrimitives.cs 2020-04-22 10:03:51 +02:00
Jan Tattermusch
dd97af88db deduplicate ExtensionSet.TryMergeFieldFrom implementation, add test 2020-04-22 09:03:15 +02:00
Jan Tattermusch
cf49962c57 actually use ParsingPrimitives.ReadBytes and ReadString 2020-04-21 16:58:32 +02:00
Jan Tattermusch
d7c1fab00b add benchmarks for parsing string and bytes 2020-04-21 16:31:32 +02:00
Jan Tattermusch
556cb8dc4b remove unused internal method 2020-04-21 14:49:12 +02:00
Jan Tattermusch
7f42d7c65b increase MapField test coverage 2020-04-21 14:44:13 +02:00
Jan Tattermusch
7c74e3901b deduplicate MapField implementation 2020-04-21 14:32:15 +02:00
Jan Tattermusch
9ca70db2aa remove a few more TODOs 2020-04-16 13:24:42 +02:00
Jan Tattermusch
a171f6d670 address a few TODOs 2020-04-16 13:02:11 +02:00
Jan Tattermusch
373b9eaeb2 optimize ParseRawLittleEndian32 2020-04-15 18:28:18 +02:00
Jan Tattermusch
17ea4d932f add LegacyGeneratedCodeTest 2020-04-15 12:45:04 +02:00
Jan Tattermusch
f1d12ac768 also test with ParseContext in CodedInputStream test 2020-04-15 11:26:58 +02:00
Jan Tattermusch
9f00d3279b add missing assert to CodedInputStreamTest.AssertReadVarint 2020-04-15 10:41:12 +02:00
Jan Tattermusch
238fd35f1d improve test coverage 2020-04-15 10:08:19 +02:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Jan Tattermusch
b2d5ceb1f7 speedup parsing multi-segment readOnlySequence 2020-04-14 19:24:19 +02:00
Jan Tattermusch
a980705bdb attempt to fix CompatibilityTests 2020-04-14 18:16:18 +02:00
Jan Tattermusch
638a0813b4 increase coverage of GeneratedMessageTest 2020-04-14 18:04:47 +02:00
Jan Tattermusch
0df7ddc805 regenerate 2020-04-14 12:47:32 +02:00
Jan Tattermusch
d7e2c8387a change MergeFrom_Internal to InternalMergeFrom 2020-04-14 12:47:32 +02:00
Jan Tattermusch
3936114642 remove newline 2020-04-14 10:44:55 +02:00
James Newton-King
18bfd9e2e5 Fix net45 tests 2020-04-14 10:37:30 +02:00
Jan Tattermusch
07182a843c optimize initialization of ParseContext 2020-04-14 09:37:59 +02:00
Jan Tattermusch
d17b5115d2 faster initialization of ParserInternalState 2020-04-14 09:37:59 +02:00
Jan Tattermusch
42eff9d640 ParseMessageBenchmark: parsing from ReadOnlySequence 2020-04-14 09:37:59 +02:00
Jan Tattermusch
5f836193c7 ParseRawPrimitivesBenchmark: compare CodedInputStream vs ParseContext 2020-04-14 09:37:59 +02:00