Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa committed Jan 14, 2025
1 parent b011652 commit 9ed3d5e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kclvm/evaluator/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ pub fn type_pack_and_check(
}
}
panic!(
"expect {expected_type}, got {}.{}",
"expect {expected_type}, got {}{}",
val_plan::type_of(value, true),
if error_msgs.is_empty() {
"".to_string()
} else {
format!("For details:\n{}", error_msgs.join("\n"))
format!(". For details:\n{}", error_msgs.join("\n"))
}
);
}
Expand Down
4 changes: 3 additions & 1 deletion test/grammar/types/runtime_ty/runtime_ty_err_0/stderr.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ error[E3M38]: EvaluationError
--> ${CWD}/main.k:7:1
|
7 | person: Person = json.decode('{"err_name": "Alice", "age": 18}')
| expect Person, got dict
| expect Person, got dict.For details:
Schema Person does not contain attribute err_name
Schema Person's attribute name is missing
|
4 changes: 3 additions & 1 deletion test/grammar/types/type_as/type_as_err_2/stderr.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ error[E3M38]: EvaluationError
--> ${CWD}/main.k:8:1
|
8 | bar = foo as Bar
| expect Bar, got Foo
| expect Bar, got Foo.For details:
Schema Bar does not contain attribute foo
Schema Bar's attribute bar is missing
|
4 changes: 3 additions & 1 deletion test/grammar/types/type_as/type_as_err_3/stderr.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ error[E3M38]: EvaluationError
--> ${CWD}/child/child.k:15:1
|
15 | base_a: A = _base_a as A
| expect A, got base.A
| expect A, got base.A.For details:
Schema A does not contain attribute bar
Schema A's attribute foo is missing
|
4 changes: 3 additions & 1 deletion test/grammar/types/type_as/type_as_err_4/stderr.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ error[E3M38]: EvaluationError
--> ${CWD}/main.k:18:1
|
18 | child_a = _child_a as A
| expect A, got child.A
| expect A, got child.A. For details:
Schema A does not contain attribute foo
Schema A's attribute main is missing
|

0 comments on commit 9ed3d5e

Please sign in to comment.