diff --git a/src/wasm-lib/kcl/src/ast/types.rs b/src/wasm-lib/kcl/src/ast/types.rs index bdc8900a0..3543b3b46 100644 --- a/src/wasm-lib/kcl/src/ast/types.rs +++ b/src/wasm-lib/kcl/src/ast/types.rs @@ -1091,7 +1091,7 @@ impl CallExpression { function_expression.params.len(), fn_args.len(), ), - source_ranges: vec![(function_expression).into()], + source_ranges: vec![self.into()], })); } diff --git a/src/wasm-lib/tests/executor/main.rs b/src/wasm-lib/tests/executor/main.rs index c4ce467d0..94f5f578a 100644 --- a/src/wasm-lib/tests/executor/main.rs +++ b/src/wasm-lib/tests/executor/main.rs @@ -1215,3 +1215,24 @@ const part003 = startSketchOn(part002, "end") .unwrap(); 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" }"# + ); +}