Fix ascription to array type to not convert units (#7160)

This commit is contained in:
Jonathan Tran
2025-05-21 17:22:30 -04:00
committed by GitHub
parent f5c244dbb1
commit ed979d807b
5 changed files with 142 additions and 82 deletions

View File

@ -177,7 +177,7 @@ impl Args {
)));
};
let arg = arg.value.coerce(ty, exec_state).map_err(|_| {
let arg = arg.value.coerce(ty, true, exec_state).map_err(|_| {
let actual_type = arg.value.principal_type();
let actual_type_name = actual_type
.as_ref()
@ -297,7 +297,7 @@ impl Args {
vec![self.source_range],
)))?;
let arg = arg.value.coerce(ty, exec_state).map_err(|_| {
let arg = arg.value.coerce(ty, true, exec_state).map_err(|_| {
let actual_type = arg.value.principal_type();
let actual_type_name = actual_type
.as_ref()

View File

@ -344,7 +344,7 @@ fn array_to_point3d(
source_ranges: Vec<SourceRange>,
exec_state: &mut ExecState,
) -> Result<[TyF64; 3], KclError> {
val.coerce(&RuntimeType::point3d(), exec_state)
val.coerce(&RuntimeType::point3d(), true, exec_state)
.map_err(|e| {
KclError::Semantic(KclErrorDetails::new(
format!(
@ -364,7 +364,7 @@ fn array_to_point2d(
source_ranges: Vec<SourceRange>,
exec_state: &mut ExecState,
) -> Result<[TyF64; 2], KclError> {
val.coerce(&RuntimeType::point2d(), exec_state)
val.coerce(&RuntimeType::point2d(), true, exec_state)
.map_err(|e| {
KclError::Semantic(KclErrorDetails::new(
format!(