Skip to content

Commit

Permalink
fix: parser and ast crate test cases
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jan 17, 2024
1 parent 522e03d commit 01de41b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion kclvm/ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ pub enum ExprContext {

/// A expression
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(tag = "type", content = "data")]
#[serde(tag = "type", content = "value")]
pub enum Type {
Any,
Named(Identifier),
Expand Down
2 changes: 1 addition & 1 deletion kclvm/ast/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn get_dummy_assign_binary_ast() -> ast::Node<ast::AssignStmt> {
))],
value: Box::new(ast::Node::new(
ast::Expr::Binary(ast::BinaryExpr {
op: ast::BinOrCmpOp::Bin(ast::BinOp::Add),
op: ast::BinOp::Add,
left: Box::new(ast::Node::new(
ast::Expr::Identifier(ast::Identifier {
names: vec![Node::dummy_node(String::from("a"))],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"ty": {
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "hello.k",
"line": 8,
Expand Down Expand Up @@ -104,7 +104,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "hello.k",
"line": 9,
Expand Down Expand Up @@ -152,7 +152,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"ty": {
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "hello.k",
"line": 10,
Expand Down Expand Up @@ -198,7 +198,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "hello.k",
"line": 11,
Expand Down Expand Up @@ -877,7 +877,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"key_ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "hello.k",
"line": 7,
Expand All @@ -888,7 +888,7 @@ expression: "crate::tests::parsing_file_ast_json(\"hello.k\",\n r####\"\nsche
"value_ty": {
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "hello.k",
"line": 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/config_expr-04.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "config_expr-04.k",
"line": 4,
Expand Down Expand Up @@ -80,7 +80,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/config_expr-04.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "config_expr-04.k",
"line": 5,
Expand Down Expand Up @@ -144,11 +144,11 @@ expression: "crate::tests::parsing_file_string(\"testdata/config_expr-04.k\")"
"ty": {
"node": {
"type": "List",
"data": {
"value": {
"inner_type": {
"node": {
"type": "Named",
"data": {
"value": {
"names": [
{
"node": "Env",
Expand Down Expand Up @@ -233,7 +233,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/config_expr-04.k\")"
"ty": {
"node": {
"type": "Named",
"data": {
"value": {
"names": [
{
"node": "Main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/hello_win.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "hello_win.k",
"line": 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Bool"
"value": "Bool"
},
"filename": "type-01.k",
"line": 3,
Expand Down Expand Up @@ -142,7 +142,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "type-01.k",
"line": 4,
Expand Down Expand Up @@ -192,7 +192,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Float"
"value": "Float"
},
"filename": "type-01.k",
"line": 5,
Expand Down Expand Up @@ -242,7 +242,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "type-01.k",
"line": 6,
Expand Down Expand Up @@ -292,7 +292,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "List",
"data": {
"value": {
"inner_type": null
}
},
Expand Down Expand Up @@ -344,11 +344,11 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "List",
"data": {
"value": {
"inner_type": {
"node": {
"type": "List",
"data": {
"value": {
"inner_type": null
}
},
Expand Down Expand Up @@ -408,11 +408,11 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "List",
"data": {
"value": {
"inner_type": {
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "type-01.k",
"line": 10,
Expand Down Expand Up @@ -470,12 +470,12 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
"ty": {
"node": {
"type": "Union",
"data": {
"value": {
"type_elements": [
{
"node": {
"type": "Basic",
"data": "Int"
"value": "Int"
},
"filename": "type-01.k",
"line": 12,
Expand All @@ -486,7 +486,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
{
"node": {
"type": "Basic",
"data": "Str"
"value": "Str"
},
"filename": "type-01.k",
"line": 12,
Expand All @@ -497,7 +497,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
{
"node": {
"type": "List",
"data": {
"value": {
"inner_type": null
}
},
Expand All @@ -510,7 +510,7 @@ expression: "crate::tests::parsing_file_string(\"testdata/type-01.k\")"
{
"node": {
"type": "Dict",
"data": {
"value": {
"key_type": null,
"value_type": null
}
Expand Down

0 comments on commit 01de41b

Please sign in to comment.