`GeneratedMessage.hasField` documentation can be confusing
- Dominant language
- Dart
- Stars
- 572
- Forks
- 196
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 2
Description
Maybe I'm being pedantic, but...
```dart
/// Whether this message has a field associated with [tagNumber].
bool hasField(int tagNumber) => _fieldSet._hasField(tagNumber);
```
This can be interpreted as one of these:
- Whether the proto message description has the given field
- Whether the current message object (`this`) has the given field (i.e. "presence")
The difference is important. For example, if I have this message description:
```proto
message MyMsg {
int32 i = 1;
}
```
and I create an empty message, then merge a message with field tag 2, `[msg.hasField(1), msg.hasField(2)]` will be [true, false] in the first interpretation, `[false, true]` in the second.
We should clarify that this method is about the fields set in the current message object.
Contributor guide
Research direction
Locate the GeneratedMessage.hasField declaration and read its current documentation in context. Clarify that the method describes fields set in the current message object, then verify the wording distinguishes message-field presence from the proto message description.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100