Rust: Add data flow test with assignment to mutable variable

This commit is contained in:
Simon Friis Vindum
2024-11-04 20:00:36 +01:00
parent 8d59b9289b
commit d9636b37b6
3 changed files with 18 additions and 11 deletions

View File

@@ -1,14 +1,14 @@
uniqueEnclosingCallable
| main.rs:6:18:6:27 | Param | Node should have one enclosing callable but has 0. |
| main.rs:25:21:25:26 | Param | Node should have one enclosing callable but has 0. |
| main.rs:25:29:25:34 | Param | Node should have one enclosing callable but has 0. |
| main.rs:25:37:25:50 | Param | Node should have one enclosing callable but has 0. |
| main.rs:31:21:31:26 | Param | Node should have one enclosing callable but has 0. |
| main.rs:31:29:31:34 | Param | Node should have one enclosing callable but has 0. |
| main.rs:31:37:31:50 | Param | Node should have one enclosing callable but has 0. |
uniqueCallEnclosingCallable
| main.rs:3:14:3:33 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:33:5:33:14 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:34:5:34:23 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:39:5:39:14 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:40:5:40:23 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| main.rs:6:18:6:27 | Param | Node should have one type but has 0. |
| main.rs:25:21:25:26 | Param | Node should have one type but has 0. |
| main.rs:25:29:25:34 | Param | Node should have one type but has 0. |
| main.rs:25:37:25:50 | Param | Node should have one type but has 0. |
| main.rs:31:21:31:26 | Param | Node should have one type but has 0. |
| main.rs:31:29:31:34 | Param | Node should have one type but has 0. |
| main.rs:31:37:31:50 | Param | Node should have one type but has 0. |

View File

@@ -6,6 +6,7 @@
| main.rs:20:9:20:15 | BreakExpr | main.rs:19:13:21:5 | LoopExpr |
| main.rs:20:15:20:15 | a | main.rs:20:9:20:15 | BreakExpr |
| main.rs:22:5:22:5 | b | main.rs:17:29:23:1 | BlockExpr |
| main.rs:26:5:29:5 | MatchExpr | main.rs:25:60:30:1 | BlockExpr |
| main.rs:27:20:27:20 | a | main.rs:26:5:29:5 | MatchExpr |
| main.rs:28:17:28:17 | b | main.rs:26:5:29:5 | MatchExpr |
| main.rs:28:5:28:5 | i | main.rs:25:24:29:1 | BlockExpr |
| main.rs:32:5:35:5 | MatchExpr | main.rs:31:60:36:1 | BlockExpr |
| main.rs:33:20:33:20 | a | main.rs:32:5:35:5 | MatchExpr |
| main.rs:34:17:34:17 | b | main.rs:32:5:35:5 | MatchExpr |

View File

@@ -22,6 +22,12 @@ fn loop_expression() -> i64 {
b
}
fn assignment() -> i64 {
let mut i = 1;
i = 2;
i
}
fn match_expression(a: i64, b: i64, c: Option<i64>) -> i64 {
match c {
Some(_) => a,