* Move last uses of untypeed arg getters
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Rename _typed functions
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
We've changed the unnamed field of `KclError` variants to a named called `details`.
To clarify: previously KCL errors looked like this:
```rust
pub enum KclError {
Lexical(KclErrorDetails),
Syntax(KclErrorDetails),
```
Now they look like this:
```rust
pub enum KclError {
Lexical { details: KclErrorDetails },
Syntax { details: KclErrorDetails },
}
```
This lets us more easily add fields to the errors. For example, in the UndefinedValue case, adding a field for what the undefined name was. This PR refactors the code to make my PR in https://github.com/KittyCAD/modeling-app/pull/7309 much easier.
Pure refactor, should not change any behaviour.
* Replace uses of get_unlabeled_kw_arg with _typed version
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Remove more untyped arg getters
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add backtrace to errors
* Add display of backtraces with hints
* Change pane badge to only show count of errors
* Fix property name to not collide with Error superclass
* Increase min stack again
* Add e2e test that checks that the diagnostics are created in CodeMirror
* Remove unneeded code
* Change to the new hotness
* Shuffle around function call code
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Refactor function calls to share more code
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Hack to leave the result of revolve as a singleton rather than array
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move the leg functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move array functions to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Move clone to KCL
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add a function type
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add sim test for any type
* Fix doc comments to match code
* Add array ascription tests
* Commit new test output
* Fix to not panic when type is undefined
* Fix to not panic on use of the any type
* Update test and generated output
* Fix error message after rebase
* Fix subtype of any
* Fix KCL to use new keyword args
* Fix to not nest MixedArray in HomArray
* Update output
* Remove all creation of MixedArray and use HomArray instead
* Rename MixedArray to Tuple
* Fix to coerce arrays the way tuples are done
* Restructure to appease the type signature extraction
* Fix TS unit test
* Update output after switch to HomArray
* Update docs
* Fix to remove edge case when creating points
* Update docs with broken point signature
* Fix display of tuples to not collide with arrays
* Change push to an array with type mismatch to be an error
* Add sim test for push type error
* Fix acription to more general array element type
* Fix to coerce point types
* Change array push to not error when item type differs
* Fix coercion tests
* Change to only flatten as a last resort and remove flattening tuples
* Contort code to appease doc generation
* Update docs
* Fix coerce axes
* Fix flattening test to test arrays instead of tuples
* Remove special subtype case for singleton coercion
* Change array functions to call user function with keyword args
* Fix KCL to use keyword params
* Remove unneeded positional call code
* Update docs
* Update output
Preparing for the removal of positional functions from the language. The first big step is to change all our KCL code examples, test code, public samples etc to all use keyword functions.
Apologies for how large this PR is. Most of it is:
- Changing example KCL that defined its own functions, so the functions now use keyword arguments rather than positional arguments. E.g. change `cube([20, 20])` to be `cube(center = [20, 20])`.
- Some parts of the code assumed positional code and didn't handle keyword calls, e.g. the linter would only check for positional calls to startSketchOn. Now they should work with either positional or keyword.
- Update all the artifacts
This does _not_ remove support for positional calls. That will be in a follow-up PR.
* Make some things a little less public
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Rename KclValue::Array to MixedArray
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Add settings to KclValue::Function
Signed-off-by: Nick Cameron <nrc@ncameron.org>
* Remove a bunch of dead code, simplifying mock exec and meaning KclValue no longer needs to deserialize
Signed-off-by: Nick Cameron <nrc@ncameron.org>
---------
Signed-off-by: Nick Cameron <nrc@ncameron.org>