xso-proc: improve error messages on cast mismatch for extracts

The old error message was pointing at the `FromXml` / `AsXml` invocation
and not on the field which actually caused the problem. The new error
message points exactly at the type of the affected field.
This commit is contained in:
Jonas Schäfer 2024-08-18 11:50:41 +02:00
commit c01eb090b8
2 changed files with 30 additions and 8 deletions

View file

@ -572,6 +572,15 @@ impl Compound {
}
}
/// Construct a tuple type with this compound's field's types in the same
/// order as they appear in the compound.
pub(crate) fn to_single_or_tuple_ty(&self) -> Type {
match self.single_ty() {
None => self.to_tuple_ty().into(),
Some(v) => v.clone(),
}
}
/// Construct a tuple type with references to this compound's field's
/// types in the same order as they appear in the compound, with the given
/// lifetime.