Kwargs: assert functions (#6406)

Closes https://github.com/KittyCAD/modeling-app/issues/6408
This commit is contained in:
Adam Chalmers
2025-04-22 12:44:52 -05:00
committed by GitHub
parent 8be36d3d16
commit f99e44e371
73 changed files with 4790 additions and 4034 deletions

View File

@ -11,65 +11,23 @@ description: Result of parsing comparisons_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"name": "error",
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "3",
"raw": "\"this should not compile\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 0,
"end": 0,
"raw": "\"this should not compile\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "this should not compile"
"value": "this should not compile"
}
}
],
"callee": {
@ -90,8 +48,60 @@ description: Result of parsing comparisons_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"left": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "==",
"right": {
"commentStart": 0,
"end": 0,
"raw": "3",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -1,12 +1,12 @@
---
source: kcl/src/simulation_tests.rs
source: kcl-lib/src/simulation_tests.rs
description: Error from executing comparisons_multiple.kcl
---
KCL Semantic error
× semantic: Expected a number, but found a boolean (true/false value)
╭────
1 │ assert(3 == 3 == 3, "this should not compile")
1 │ assert(3 == 3 == 3, error = "this should not compile")
· ───┬──
· ╰── tests/comparisons_multiple/input.kcl
╰────

View File

@ -1 +1 @@
assert(3 == 3 == 3, "this should not compile")
assert(3 == 3 == 3, error = "this should not compile")

View File

@ -2,4 +2,4 @@
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing comparisons_multiple.kcl
---
assert(3 == 3 == 3, "this should not compile")
assert(3 == 3 == 3, error = "this should not compile")