Fix to not panic when using the wrong argument type (#7474)

This commit is contained in:
Jonathan Tran
2025-06-13 14:02:14 -04:00
committed by GitHub
parent 2ef84382a6
commit c6b1d11700

View File

@ -166,8 +166,12 @@ impl Args {
KclError::new_semantic(KclErrorDetails::new(message, arg.source_ranges())) KclError::new_semantic(KclErrorDetails::new(message, arg.source_ranges()))
})?; })?;
// TODO unnecessary cloning T::from_kcl_val(&arg).ok_or_else(|| {
Ok(T::from_kcl_val(&arg).unwrap()) KclError::new_internal(KclErrorDetails::new(
format!("Mismatch between type coercion and value extraction (this isn't your fault).\nTo assist in bug-reporting, expected type: {ty:?}; actual value: {arg:?}"),
vec![self.source_range],
))
})
} }
/// Get a labelled keyword arg, check it's an array, and return all items in the array /// Get a labelled keyword arg, check it's an array, and return all items in the array