@param tags are permitted on enumerators (only_operations_have_parameters in slicec/src/validators/comments.rs allows Entities::Enumerator), but unlike operation parameters (validate_param_tags in slicec/src/validators/operations.rs) the tag's identifier is never checked against the enumerator's fields, and nothing rejects the tag on an enumerator that has no fields. All three of these compile without a single lint:
module tests
enum E {
/// @param nmae: typo, no field is called 'nmae'
A(name: string)
/// @param x: this enumerator has no fields
B
}
enum Status : int32 {
/// @param code: enumerators of a basic enum can never have fields
Ok = 0
}
With #818, a variant field only receives a comment when a @param tag names it, so the typo above silently produces an undocumented field in the generated code; the other two tags are silently discarded.
Suggested fix: validate enumerator @param identifiers against enumerator.fields() the same way validate_param_tags does for operations. That also rejects @param on fieldless and basic-enum enumerators.
Found while reviewing #818 (Claude Fable 5.1, cross-checked with Codex; the silent acceptance was confirmed by compiling the snippet above and observing zero diagnostics). Not yet human-triaged.
@paramtags are permitted on enumerators (only_operations_have_parametersinslicec/src/validators/comments.rsallowsEntities::Enumerator), but unlike operation parameters (validate_param_tagsinslicec/src/validators/operations.rs) the tag's identifier is never checked against the enumerator's fields, and nothing rejects the tag on an enumerator that has no fields. All three of these compile without a single lint:With #818, a variant field only receives a comment when a
@paramtag names it, so the typo above silently produces an undocumented field in the generated code; the other two tags are silently discarded.Suggested fix: validate enumerator
@paramidentifiers againstenumerator.fields()the same wayvalidate_param_tagsdoes for operations. That also rejects@paramon fieldless and basic-enum enumerators.Found while reviewing #818 (Claude Fable 5.1, cross-checked with Codex; the silent acceptance was confirmed by compiling the snippet above and observing zero diagnostics). Not yet human-triaged.