Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate target type for all option fields, not just features (bufbui…
…ld#279) The code to verify that a feature field was only used on particular kind of element was features-specific. However, in `protoc`, it is not features-specific and applies to _all_ option fields that have a `targets` option defined. So this updates protocompile to behave the same way. This PR is a bit complicated because I had to change the error handling of the `*interpreter.fieldValue` method (and the `setOptionField` method that called it, as well as numerous methods that it used). It previously either returned a value or an error. If it returned an error, it would be reported by the caller. But now, these places handle the errors, to allow reporting of multiple errors for the same option value. This change in behavior is the reason for most of the churn/change in the code. The change to just the target type validation is actually a net simplification. (cherry picked from commit e8799f7)
- Loading branch information