Move some more functions to be declared in KCL (#6856)

* 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>
This commit is contained in:
Nick Cameron
2025-05-13 08:29:38 +12:00
committed by GitHub
parent 818d9a0d77
commit a049768f1c
61 changed files with 948 additions and 35813 deletions

View File

@ -4,11 +4,20 @@ description: Error from executing argument_error.kcl
---
KCL Semantic error
× semantic: This function expected the input argument to be of type
│ Vec<KclValue> but it's actually of type Function
╭─[5:5]
× semantic: f requires a value with type `Fn`, but found array (list)
╭─[5:1]
4 │
5 │ map(f, f = [0, 1])
·
· ╰── tests/argument_error/input.kcl
· ─────────┬────────
· ╰── tests/argument_error/input.kcl
· ╰── tests/argument_error/input.kcl
╰────
╰─▶ KCL Semantic error
× semantic: f requires a value with type `Fn`, but found array (list)
╭─[5:12]
4 │
5 │ map(f, f = [0, 1])
· ───┬──
· ╰── tests/argument_error/input.kcl
╰────

View File

@ -4,10 +4,22 @@ description: Error from executing array_elem_pop_empty_fail.kcl
---
KCL Semantic error
× semantic: Cannot pop from an empty array
× semantic: The input argument of `std::array::pop` requires a value with
│ type `[any; 1+]`, but found array (list)
╭─[2:8]
1 │ arr = []
2 │ fail = pop(arr)
· ────┬───
· ────┬───
· │ ╰── tests/array_elem_pop_empty_fail/input.kcl
· ╰── tests/array_elem_pop_empty_fail/input.kcl
╰────
╰─▶ KCL Semantic error
× semantic: The input argument of `std::array::pop` requires a value
│ with type `[any; 1+]`, but found array (list)
╭─[2:12]
1 │ arr = []
2 │ fail = pop(arr)
· ─┬─
· ╰── tests/array_elem_pop_empty_fail/input.kcl
╰────

View File

@ -105,10 +105,8 @@ description: Operations executed clone_w_fillets.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"type": "KclStdLibCall",
"name": "clone",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
@ -117,6 +115,8 @@ description: Operations executed clone_w_fillets.kcl
}
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
}
]

View File

@ -98,10 +98,8 @@ description: Operations executed clone_w_shell.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"type": "KclStdLibCall",
"name": "clone",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
@ -110,6 +108,8 @@ description: Operations executed clone_w_shell.kcl
}
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
}
]

View File

@ -678,7 +678,7 @@ flowchart LR
99 --- 245
99 --- 293
106 --- 193
106 x--> 206
106 x--> 207
106 --- 272
106 --- 321
126 --- 194
@ -1012,7 +1012,7 @@ flowchart LR
233 <--x 205
234 <--x 205
235 <--x 205
272 <--x 207
272 <--x 206
254 <--x 213
255 <--x 213
256 <--x 213

View File

@ -709,6 +709,7 @@ flowchart LR
115 --- 179
115 x--> 228
115 --- 256
115 x--> 307
115 --- 308
164 <--x 116
116 --- 184

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 174 KiB

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB