Type check and coerce arguments to user functions and return values from std Rust functions (#6958)

* 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>
This commit is contained in:
Nick Cameron
2025-05-19 16:50:15 +12:00
committed by GitHub
parent f3e9d110c0
commit b19acd550d
197 changed files with 13837 additions and 14317 deletions

View File

@ -4,20 +4,20 @@ description: Operations executed helium-tank.kcl
---
[
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "revolve",
"unlabeledArg": {
"value": {
@ -124,20 +124,20 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -163,6 +163,17 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"length": {
"value": {
@ -188,21 +199,10 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "fillet",
"unlabeledArg": {
"value": {
@ -246,19 +246,30 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -270,9 +281,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -281,9 +294,7 @@ description: Operations executed helium-tank.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"length": {
"value": {
@ -302,24 +313,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {},
"name": "union",
"sourceRange": [],
"type": "StdLibCall",
"name": "union",
"unlabeledArg": {
"value": {
"type": "Array",
@ -339,23 +337,25 @@ description: Operations executed helium-tank.kcl
]
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -381,20 +381,20 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -420,6 +420,17 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -431,9 +442,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -442,9 +455,7 @@ description: Operations executed helium-tank.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"length": {
"value": {
@ -470,34 +481,23 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -523,6 +523,17 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -534,9 +545,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -545,9 +558,7 @@ description: Operations executed helium-tank.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"length": {
"value": {
@ -573,20 +584,25 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"tools": {
"value": {
@ -603,39 +619,23 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "subtract",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -665,6 +665,17 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"length": {
"value": {
@ -683,34 +694,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {
"tools": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
"name": "subtract",
"sourceRange": [],
"type": "StdLibCall",
"name": "subtract",
"unlabeledArg": {
"value": {
"type": "Array",
@ -724,13 +712,23 @@ description: Operations executed helium-tank.kcl
]
},
"sourceRange": []
}
},
"labeledArgs": {
"tools": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "union",
"sourceRange": [],
"type": "StdLibCall",
"name": "union",
"unlabeledArg": {
"value": {
"type": "Array",
@ -750,9 +748,22 @@ description: Operations executed helium-tank.kcl
]
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -834,34 +845,23 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"name": "startSketchOn",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
"labeledArgs": {},
"sourceRange": []
},
{
"type": "KclStdLibCall",
"type": "StdLibCall",
"name": "offsetPlane",
"unlabeledArg": {
"value": {
@ -887,6 +887,17 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "subtract2d",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"labeledArgs": {
"tool": {
"value": {
@ -898,9 +909,11 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "subtract2d",
"sourceRange": [],
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "extrude",
"unlabeledArg": {
"value": {
"type": "Sketch",
@ -909,9 +922,7 @@ description: Operations executed helium-tank.kcl
}
},
"sourceRange": []
}
},
{
},
"labeledArgs": {
"length": {
"value": {
@ -937,20 +948,31 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
"sourceRange": []
},
{
"type": "StdLibCall",
"name": "patternLinear3d",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"axis": {
"value": {
@ -1028,28 +1050,6 @@ description: Operations executed helium-tank.kcl
"sourceRange": []
}
},
"name": "patternLinear3d",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
{
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
"sourceRange": []
}
]