fix error sourcce range for kcl stdlib (#1641)

fix error

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-03-05 12:46:05 -08:00
committed by GitHub
parent fe6478f568
commit 22cc4c9a98
2 changed files with 22 additions and 1 deletions

View File

@ -1091,7 +1091,7 @@ impl CallExpression {
function_expression.params.len(), function_expression.params.len(),
fn_args.len(), fn_args.len(),
), ),
source_ranges: vec![(function_expression).into()], source_ranges: vec![self.into()],
})); }));
} }

View File

@ -1215,3 +1215,24 @@ const part003 = startSketchOn(part002, "end")
.unwrap(); .unwrap();
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_of_face.png", &result, 1.0); twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_of_face.png", &result, 1.0);
} }
#[tokio::test(flavor = "multi_thread")]
async fn serial_test_stdlib_kcl_error_right_code_path() {
let code = r#"const square = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %)
|> line([10, 0], %)
|> line([0, -10], %)
|> close(%)
|> hole(circle([2, 2], .5), %)
|> hole(circle('XY', [2, 8], .5), %)
|> extrude(2, %)
"#;
let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm).await;
assert!(result.is_err());
assert_eq!(
result.err().unwrap().to_string(),
r#"semantic: KclErrorDetails { source_ranges: [SourceRange([157, 175])], message: "this function expected 3 arguments, got 2" }"#
);
}