mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Add suggestions for quaternionN or complexN conversions
Quaternions and complex numbers are constructed with `quaternion` and `complex`, but their types are of the `*N` form. These suggestions should point the user in the right direction.
This commit is contained in:
+21
-1
@@ -7960,7 +7960,27 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
gbString str = type_to_string(t);
|
gbString str = type_to_string(t);
|
||||||
error(call, "Too many arguments in conversion to '%s'", str);
|
if (t->kind == Type_Basic) {
|
||||||
|
ERROR_BLOCK();
|
||||||
|
switch (t->Basic.kind) {
|
||||||
|
case Basic_complex32:
|
||||||
|
case Basic_complex64:
|
||||||
|
case Basic_complex128:
|
||||||
|
error(call, "Too many arguments in conversion to '%s'", str);
|
||||||
|
error_line("\tSuggestion: %s(1+2i) or construct with 'complex'\n", str);
|
||||||
|
break;
|
||||||
|
case Basic_quaternion64:
|
||||||
|
case Basic_quaternion128:
|
||||||
|
case Basic_quaternion256:
|
||||||
|
error(call, "Too many arguments in conversion to '%s'", str);
|
||||||
|
error_line("\tSuggestion: %s(1+2i+3j+4k) or construct with 'quaternion'\n", str);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
error(call, "Too many arguments in conversion to '%s'", str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error(call, "Too many arguments in conversion to '%s'", str);
|
||||||
|
}
|
||||||
gb_string_free(str);
|
gb_string_free(str);
|
||||||
} break;
|
} break;
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|||||||
Reference in New Issue
Block a user