Skip to content

Commit db9f683

Browse files
committed
feat(vm): in type errors, display the bad values as code, to add the quotes around strings
1 parent d1c6a2a commit db9f683

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/Ark/VM/VM.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ inline void VM::call(internal::ExecutionContext& context, const uint16_t argc, V
325325
ErrorKind::Type,
326326
fmt::format(
327327
"{} is not a Function but a {}",
328-
maybe_value_ptr->toString(*this), std::to_string(call_type)));
328+
maybe_value_ptr->toString(*this, /* show_as_code= */ true), std::to_string(call_type)));
329329
}
330330
}
331331

tests/unittests/resources/DiagnosticsSuite/runtime/call_let_mut_not_a_function.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TypeError: hello is not a Function but a String
1+
TypeError: "hello" is not a Function but a String
22

33
In file tests/unittests/resources/DiagnosticsSuite/runtime/call_let_mut_not_a_function.ark:1
44
1 | (mut output ((let T "hello") (mut T print)))

0 commit comments

Comments
 (0)