KCL: Fix cryptic error on unexpected tokens in fn call (#7295)

This program:
```kcl
1
|> extrude(
  length=depth,
})
```

was giving this bad error:

```
unexpected token |>
```

Now it gives

```kcl
There was an unexpected }. Try removing it.
```

and it correctly puts the diagnostic on the extra }.

Fixes https://github.com/KittyCAD/modeling-app/issues/6126
This commit is contained in:
Adam Chalmers
2025-05-30 13:57:05 -05:00
committed by GitHub
parent a506f7f698
commit 5fccaad0e7
2 changed files with 42 additions and 10 deletions

View File

@ -2072,8 +2072,8 @@ notPipeSub = 1 |> identity(!%))";
// a runtime error instead.
parse_execute(code11).await.unwrap_err(),
KclError::Syntax(KclErrorDetails::new(
"Unexpected token: |>".to_owned(),
vec![SourceRange::new(44, 46, ModuleId::default())],
"There was an unexpected !. Try removing it.".to_owned(),
vec![SourceRange::new(56, 57, ModuleId::default())],
))
);