aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-11-12 19:00:48 +0000
committergingerBill <bill@gingerbill.org>2017-11-12 19:00:48 +0000
commitdffa7916075abb7770fcf655b1d9306385b4e748 (patch)
treefdfab9dab21a05a377cee7ec9942c7605c1256b9 /src
parent5ce65557219d57d19e9e45c5670b48bb40e22c3f (diff)
In error messages, remove ` with '; Fix error messages for `switch`
Diffstat (limited to 'src')
-rw-r--r--src/check_decl.cpp64
-rw-r--r--src/check_expr.cpp400
-rw-r--r--src/check_stmt.cpp188
-rw-r--r--src/check_type.cpp94
-rw-r--r--src/checker.cpp134
-rw-r--r--src/exact_value.cpp4
-rw-r--r--src/ir.cpp48
-rw-r--r--src/main.cpp40
-rw-r--r--src/parser.cpp122
9 files changed, 547 insertions, 547 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 940e9cc3b..72c8dcd0d 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -1,7 +1,7 @@
bool check_is_terminating(AstNode *node);
void check_stmt (Checker *c, AstNode *node, u32 flags);
-// NOTE(bill): `content_name` is for debugging and error messages
+// NOTE(bill): 'content_name' is for debugging and error messages
Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String context_name) {
if (operand->mode == Addressing_Invalid ||
operand->type == t_invalid ||
@@ -13,7 +13,7 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
// TODO(bill): is this a good enough error message?
// TODO(bill): Actually allow built in procedures to be passed around and thus be created on use
error(operand->expr,
- "Cannot assign built-in procedure `%s` in %.*s",
+ "Cannot assign built-in procedure '%s' in %.*s",
expr_str,
LIT(context_name));
@@ -25,7 +25,7 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
if (operand->mode == Addressing_Overload) {
if (e->type == nullptr) {
- error(operand->expr, "Cannot determine type from overloaded procedure `%.*s`", LIT(operand->overload_entities[0]->token.string));
+ error(operand->expr, "Cannot determine type from overloaded procedure '%.*s'", LIT(operand->overload_entities[0]->token.string));
} else {
check_assignment(c, operand, e->type, str_lit("variable assignment"));
if (operand->mode != Addressing_Type) {
@@ -62,13 +62,13 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
if (is_type_polymorphic(t)) {
gbString str = type_to_string(t);
defer (gb_string_free(str));
- error(e->token, "Invalid use of a polymorphic type `%s` in %.*s", str, LIT(context_name));
+ error(e->token, "Invalid use of a polymorphic type '%s' in %.*s", str, LIT(context_name));
e->type = t_invalid;
return nullptr;
} else if (is_type_empty_union(t)) {
gbString str = type_to_string(t);
defer (gb_string_free(str));
- error(e->token, "An empty union `%s` cannot be instantiated in %.*s", str, LIT(context_name));
+ error(e->token, "An empty union '%s' cannot be instantiated in %.*s", str, LIT(context_name));
e->type = t_invalid;
return nullptr;
}
@@ -122,7 +122,7 @@ void check_init_variables(Checker *c, Entity **lhs, isize lhs_count, Array<AstNo
}
}
if (rhs_count > 0 && lhs_count != rhs_count) {
- error(lhs[0]->token, "Assignment count mismatch `%td` = `%td`", lhs_count, rhs_count);
+ error(lhs[0]->token, "Assignment count mismatch '%td' = '%td'", lhs_count, rhs_count);
}
}
@@ -139,7 +139,7 @@ void check_init_constant(Checker *c, Entity *e, Operand *operand) {
if (operand->mode != Addressing_Constant) {
// TODO(bill): better error
gbString str = expr_to_string(operand->expr);
- error(operand->expr, "`%s` is not a constant", str);
+ error(operand->expr, "'%s' is not a constant", str);
gb_string_free(str);
if (e->type == nullptr) {
e->type = t_invalid;
@@ -148,7 +148,7 @@ void check_init_constant(Checker *c, Entity *e, Operand *operand) {
}
if (!is_type_constant_type(operand->type)) {
gbString type_str = type_to_string(operand->type);
- error(operand->expr, "Invalid constant type: `%s`", type_str);
+ error(operand->expr, "Invalid constant type: '%s'", type_str);
gb_string_free(type_str);
if (e->type == nullptr) {
e->type = t_invalid;
@@ -211,7 +211,7 @@ void check_type_decl(Checker *c, Entity *e, AstNode *type_expr, Type *def, bool
e->TypeName.is_type_alias = true;
} else {
gbString str = type_to_string(bt);
- error(type_expr, "Type alias declaration with a non-named type `%s`", str);
+ error(type_expr, "Type alias declaration with a non-named type '%s'", str);
gb_string_free(str);
}
}
@@ -231,7 +231,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init,
Type *t = check_type(c, type_expr);
if (!is_type_constant_type(t)) {
gbString str = type_to_string(t);
- error(type_expr, "Invalid constant type `%s`", str);
+ error(type_expr, "Invalid constant type '%s'", str);
gb_string_free(str);
e->type = t_invalid;
return;
@@ -324,7 +324,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init,
if (operand.mode == Addressing_Invalid ||
base_type(operand.type) == t_invalid) {
gbString str = expr_to_string(init);
- error(e->token, "Invalid declaration type `%s`", str);
+ error(e->token, "Invalid declaration type '%s'", str);
gb_string_free(str);
}
@@ -415,12 +415,12 @@ void init_entity_foreign_library(Checker *c, Entity *e) {
Entity *found = scope_lookup_entity(c->context.scope, name);
if (found == nullptr) {
if (is_blank_ident(name)) {
- error(ident, "`_` cannot be used as a value type");
+ error(ident, "'_' cannot be used as a value type");
} else {
error(ident, "Undeclared name: %.*s", LIT(name));
}
} else if (found->kind != Entity_LibraryName) {
- error(ident, "`%.*s` cannot be used as a library name", LIT(name));
+ error(ident, "'%.*s' cannot be used as a library name", LIT(name));
} else {
// TODO(bill): Extra stuff to do with library names?
*foreign_library = found;
@@ -432,7 +432,7 @@ void init_entity_foreign_library(Checker *c, Entity *e) {
String handle_link_name(Checker *c, Token token, String link_name, String link_prefix) {
if (link_prefix.len > 0) {
if (link_name.len > 0) {
- error(token, "`link_name` and `link_prefix` cannot be used together");
+ error(token, "'link_name' and 'link_prefix' cannot be used together");
} else {
isize len = link_prefix.len + token.string.len;
u8 *name = gb_alloc_array(c->allocator, u8, len+1);
@@ -491,17 +491,17 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
if (pt->param_count != 0 ||
pt->result_count != 0) {
gbString str = type_to_string(proc_type);
- error(e->token, "Procedure type of `main` was expected to be `proc()`, got %s", str);
+ error(e->token, "Procedure type of 'main' was expected to be 'proc()', got %s", str);
gb_string_free(str);
}
if (pt->calling_convention != ProcCC_Odin &&
pt->calling_convention != ProcCC_Contextless) {
- error(e->token, "Procedure `main` cannot have a custom calling convention");
+ error(e->token, "Procedure 'main' cannot have a custom calling convention");
}
pt->calling_convention = ProcCC_Contextless;
if (d->scope->is_init) {
if (c->info.entry_point != nullptr) {
- error(e->token, "Redeclaration of the entry pointer procedure `main`");
+ error(e->token, "Redeclaration of the entry pointer procedure 'main'");
} else {
c->info.entry_point = e;
}
@@ -509,7 +509,7 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
}
if (is_foreign && is_export) {
- error(pl->type, "A foreign procedure cannot have an `export` tag");
+ error(pl->type, "A foreign procedure cannot have an 'export' tag");
}
if (pt->is_polymorphic) {
@@ -528,7 +528,7 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
error(pl->body, "A foreign procedure cannot have a body");
}
if (proc_type->Proc.c_vararg) {
- error(pl->body, "A procedure with a `#c_vararg` field cannot have a body and must be foreign");
+ error(pl->body, "A procedure with a '#c_vararg' field cannot have a body and must be foreign");
}
d->scope = c->context.scope;
@@ -546,7 +546,7 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
}
if (pt->result_count == 0 && is_require_results) {
- error(pl->type, "`#require_results` is not needed on a procedure with no results");
+ error(pl->type, "'#require_results' is not needed on a procedure with no results");
} else {
pt->require_results = is_require_results;
}
@@ -576,18 +576,18 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
if (is_type_proc(this_type) && is_type_proc(other_type)) {
if (!are_signatures_similar_enough(this_type, other_type)) {
error(d->proc_lit,
- "Redeclaration of foreign procedure `%.*s` with different type signatures\n"
+ "Redeclaration of foreign procedure '%.*s' with different type signatures\n"
"\tat %.*s(%td:%td)",
LIT(name), LIT(pos.file), pos.line, pos.column);
}
} else if (!are_types_identical(this_type, other_type)) {
error(d->proc_lit,
- "Foreign entity `%.*s` previously declared elsewhere with a different type\n"
+ "Foreign entity '%.*s' previously declared elsewhere with a different type\n"
"\tat %.*s(%td:%td)",
LIT(name), LIT(pos.file), pos.line, pos.column);
}
} else if (name == "main") {
- error(d->proc_lit, "The link name `main` is reserved for internal use");
+ error(d->proc_lit, "The link name 'main' is reserved for internal use");
} else {
map_set(fp, key, e);
}
@@ -605,11 +605,11 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
TokenPos pos = f->token.pos;
// TODO(bill): Better error message?
error(d->proc_lit,
- "Non unique linking name for procedure `%.*s`\n"
+ "Non unique linking name for procedure '%.*s'\n"
"\tother at %.*s(%td:%td)",
LIT(name), LIT(pos.file), pos.line, pos.column);
} else if (name == "main") {
- error(d->proc_lit, "The link name `main` is reserved for internal use");
+ error(d->proc_lit, "The link name 'main' is reserved for internal use");
} else {
map_set(fp, key, e);
}
@@ -647,12 +647,12 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count
if (is_type_polymorphic(base_type(e->type))) {
gbString str = type_to_string(e->type);
defer (gb_string_free(str));
- error(e->token, "Invalid use of a polymorphic type `%s` in %.*s", str, LIT(context_name));
+ error(e->token, "Invalid use of a polymorphic type '%s' in %.*s", str, LIT(context_name));
e->type = t_invalid;
} else if (is_type_empty_union(e->type)) {
gbString str = type_to_string(e->type);
defer (gb_string_free(str));
- error(e->token, "An empty union `%s` cannot be instantiated in %.*s", str, LIT(context_name));
+ error(e->token, "An empty union '%s' cannot be instantiated in %.*s", str, LIT(context_name));
e->type = t_invalid;
}
}
@@ -683,7 +683,7 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count
Type *other_type = base_type(f->type);
if (!are_types_identical(this_type, other_type)) {
error(e->token,
- "Foreign entity `%.*s` previously declared elsewhere with a different type\n"
+ "Foreign entity '%.*s' previously declared elsewhere with a different type\n"
"\tat %.*s(%td:%td)",
LIT(name), LIT(pos.file), pos.line, pos.column);
}
@@ -720,7 +720,7 @@ void check_entity_decl(Checker *c, Entity *e, DeclInfo *d, Type *named_type) {
e->type = t_invalid;
set_base_type(named_type, t_invalid);
return;
- // GB_PANIC("`%.*s` should been declared!", LIT(e->token.string));
+ // GB_PANIC("'%.*s' should been declared!", LIT(e->token.string));
}
}
@@ -801,13 +801,13 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod
uvar->Variable.is_immutable = is_immutable;
Entity *prev = scope_insert_entity(c->context.scope, uvar);
if (prev != nullptr) {
- error(e->token, "Namespace collision while `using` `%.*s` of: %.*s", LIT(name), LIT(prev->token.string));
+ error(e->token, "Namespace collision while 'using' '%.*s' of: %.*s", LIT(name), LIT(prev->token.string));
break;
}
}
}
} else {
- error(e->token, "`using` can only be applied to variables of type struct");
+ error(e->token, "'using' can only be applied to variables of type struct");
break;
}
}
@@ -820,7 +820,7 @@ void check_proc_body(Checker *c, Token token, DeclInfo *decl, Type *type, AstNod
if (type->Proc.result_count > 0) {
if (!check_is_terminating(body)) {
if (token.kind == Token_Ident) {
- error(bs->close, "Missing return statement at the end of the procedure `%.*s`", LIT(token.string));
+ error(bs->close, "Missing return statement at the end of the procedure '%.*s'", LIT(token.string));
} else {
error(bs->close, "Missing return statement at the end of the procedure");
}
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index a19522746..1ed657ec8 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -85,7 +85,7 @@ Type * check_init_variable (Checker *c, Entity *e, Operand *operand
void error_operand_not_expression(Operand *o) {
if (o->mode == Addressing_Type) {
gbString err = expr_to_string(o->expr);
- error(o->expr, "`%s` is not an expression but a type", err);
+ error(o->expr, "'%s' is not an expression but a type", err);
gb_string_free(err);
o->mode = Addressing_Invalid;
}
@@ -96,9 +96,9 @@ void error_operand_no_value(Operand *o) {
gbString err = expr_to_string(o->expr);
AstNode *x = unparen_expr(o->expr);
if (x->kind == AstNode_CallExpr) {
- error(o->expr, "`%s` call does not return a value and cannot be used as a value", err);
+ error(o->expr, "'%s' call does not return a value and cannot be used as a value", err);
} else {
- error(o->expr, "`%s` used as a value", err);
+ error(o->expr, "'%s' used as a value", err);
}
gb_string_free(err);
o->mode = Addressing_Invalid;
@@ -440,7 +440,7 @@ i64 check_distance_between_types(Checker *c, Operand *operand, Type *type) {
}
if (is_type_untyped(src)) {
if (is_type_any(dst)) {
- // NOTE(bill): Anything can cast to `Any`
+ // NOTE(bill): Anything can cast to 'Any'
add_type_info_type(c, s);
return 10;
}
@@ -581,7 +581,7 @@ i64 check_distance_between_types(Checker *c, Operand *operand, Type *type) {
if (is_type_any(dst)) {
if (!is_type_polymorphic(src)) {
- // NOTE(bill): Anything can cast to `Any`
+ // NOTE(bill): Anything can cast to 'Any'
add_type_info_type(c, s);
return 10;
}
@@ -617,7 +617,7 @@ bool check_is_assignable_to(Checker *c, Operand *operand, Type *type) {
}
-// NOTE(bill): `content_name` is for debugging and error messages
+// NOTE(bill): 'content_name' is for debugging and error messages
void check_assignment(Checker *c, Operand *operand, Type *type, String context_name) {
check_not_tuple(c, operand);
if (operand->mode == Addressing_Invalid) {
@@ -707,7 +707,7 @@ void check_assignment(Checker *c, Operand *operand, Type *type, String context_n
// TODO(bill): is this a good enough error message?
error(operand->expr,
- "Cannot assign overloaded procedure `%s` to `%s` in %.*s",
+ "Cannot assign overloaded procedure '%s' to '%s' in %.*s",
expr_str,
op_type_str,
LIT(context_name));
@@ -729,20 +729,20 @@ void check_assignment(Checker *c, Operand *operand, Type *type, String context_n
case Addressing_Builtin:
// TODO(bill): Actually allow built in procedures to be passed around and thus be created on use
error(operand->expr,
- "Cannot assign built-in procedure `%s` in %.*s",
+ "Cannot assign built-in procedure '%s' in %.*s",
expr_str,
LIT(context_name));
break;
case Addressing_Type:
error(operand->expr,
- "Cannot assign `%s` which is a type in %.*s",
+ "Cannot assign '%s' which is a type in %.*s",
op_type_str,
LIT(context_name));
break;
default:
// TODO(bill): is this a good enough error message?
error(operand->expr,
- "Cannot assign value `%s` of type `%s` to `%s` in %.*s",
+ "Cannot assign value '%s' of type '%s' to '%s' in %.*s",
expr_str,
op_type_str,
type_str,
@@ -958,7 +958,7 @@ Entity *check_ident(Checker *c, Operand *o, AstNode *n, Type *named_type, Type *
Entity *e = scope_lookup_entity(c->context.scope, name);
if (e == nullptr) {
if (is_blank_ident(name)) {
- error(n, "`_` cannot be used as a value type");
+ error(n, "'_' cannot be used as a value type");
} else {
error(n, "Undeclared name: %.*s", LIT(name));
}
@@ -1095,11 +1095,11 @@ Entity *check_ident(Checker *c, Operand *o, AstNode *n, Type *named_type, Type *
case Entity_ImportName:
if (!allow_import_name) {
- error(n, "Use of import `%.*s` not in selector", LIT(name));
+ error(n, "Use of import '%.*s' not in selector", LIT(name));
}
return e;
case Entity_LibraryName:
- error(n, "Use of library `%.*s` not in foreign block", LIT(name));
+ error(n, "Use of library '%.*s' not in foreign block", LIT(name));
return e;
case Entity_Label:
@@ -1123,7 +1123,7 @@ Entity *check_ident(Checker *c, Operand *o, AstNode *n, Type *named_type, Type *
bool check_unary_op(Checker *c, Operand *o, Token op) {
if (o->type == nullptr) {
gbString str = expr_to_string(o->expr);
- error(o->expr, "Expression has no value `%s`", str);
+ error(o->expr, "Expression has no value '%s'", str);
gb_string_free(str);
return false;
}
@@ -1135,27 +1135,27 @@ bool check_unary_op(Checker *c, Operand *o, Token op) {
case Token_Sub:
if (!is_type_numeric(type)) {
str = expr_to_string(o->expr);
- error(op, "Operator `%.*s` is not allowed with `%s`", LIT(op.string), str);
+ error(op, "Operator '%.*s' is not allowed with '%s'", LIT(op.string), str);
gb_string_free(str);
}
break;
case Token_Xor:
if (!is_type_integer(type) && !is_type_boolean(type)) {
- error(op, "Operator `%.*s` is only allowed with integers or booleans", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with integers or booleans", LIT(op.string));
}
break;
case Token_Not:
if (!is_type_boolean(type)) {
str = expr_to_string(o->expr);
- error(op, "Operator `%.*s` is only allowed on boolean expression", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed on boolean expression", LIT(op.string));
gb_string_free(str);
}
break;
default:
- error(op, "Unknown operator `%.*s`", LIT(op.string));
+ error(op, "Unknown operator '%.*s'", LIT(op.string));
return false;
}
@@ -1169,7 +1169,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
case Token_Sub:
case Token_SubEq:
if (!is_type_numeric(type) && !is_type_pointer(type)) {
- error(op, "Operator `%.*s` is only allowed with numeric or pointer expressions", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with numeric or pointer expressions", LIT(op.string));
return false;
}
if (is_type_pointer(type)) {
@@ -1177,7 +1177,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
}
if (base_type(type) == t_rawptr) {
gbString str = type_to_string(type);
- error(o->expr, "Invalid pointer type for pointer arithmetic: `%s`", str);
+ error(o->expr, "Invalid pointer type for pointer arithmetic: '%s'", str);
gb_string_free(str);
return false;
}
@@ -1189,7 +1189,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
case Token_MulEq:
case Token_QuoEq:
if (!is_type_numeric(type)) {
- error(op, "Operator `%.*s` is only allowed with numeric expressions", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with numeric expressions", LIT(op.string));
return false;
}
break;
@@ -1202,7 +1202,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
error(op, "String concatenation is only allowed with constant strings");
return false;
} else if (!is_type_numeric(type)) {
- error(op, "Operator `%.*s` is only allowed with numeric expressions", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with numeric expressions", LIT(op.string));
return false;
}
break;
@@ -1214,7 +1214,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
case Token_Xor:
case Token_XorEq:
if (!is_type_integer(type) && !is_type_boolean(type)) {
- error(op, "Operator `%.*s` is only allowed with integers or booleans", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with integers or booleans", LIT(op.string));
return false;
}
break;
@@ -1226,7 +1226,7 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
case Token_ModModEq:
case Token_AndNotEq:
if (!is_type_integer(type)) {
- error(op, "Operator `%.*s` is only allowed with integers", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with integers", LIT(op.string));
return false;
}
break;
@@ -1236,13 +1236,13 @@ bool check_binary_op(Checker *c, Operand *o, Token op) {
case Token_CmpAndEq:
case Token_CmpOrEq:
if (!is_type_boolean(type)) {
- error(op, "Operator `%.*s` is only allowed with boolean expressions", LIT(op.string));
+ error(op, "Operator '%.*s' is only allowed with boolean expressions", LIT(op.string));
return false;
}
break;
default:
- error(op, "Unknown operator `%.*s`", LIT(op.string));
+ error(op, "Unknown operator '%.*s'", LIT(op.string));
return false;
}
@@ -1377,7 +1377,7 @@ void check_is_expressible(Checker *c, Operand *o, Type *type) {
gbString b = type_to_string(type);
if (is_type_numeric(o->type) && is_type_numeric(type)) {
if (!is_type_integer(o->type) && is_type_integer(type)) {
- error(o->expr, "`%s` truncated to `%s`", a, b);
+ error(o->expr, "'%s' truncated to '%s'", a, b);
} else {
char buf[127] = {};
String str = {};
@@ -1387,10 +1387,10 @@ void check_is_expressible(Checker *c, Operand *o, Type *type) {
} else {
str = i128_to_string(i, buf, gb_size_of(buf));
}
- error(o->expr, "`%s = %.*s` overflows `%s`", a, LIT(str), b);
+ error(o->expr, "'%s = %.*s' overflows '%s'", a, LIT(str), b);
}
} else {
- error(o->expr, "Cannot convert `%s` to `%s`", a, b);
+ error(o->expr, "Cannot convert '%s' to '%s'", a, b);
}
gb_string_free(b);
@@ -1453,7 +1453,7 @@ void check_unary_expr(Checker *c, Operand *o, Token op, AstNode *node) {
if (ast_node_expect(node, AstNode_UnaryExpr)) {
ast_node(ue, UnaryExpr, node);
gbString str = expr_to_string(ue->expr);
- error(op, "Cannot take the pointer address of `%s`", str);
+ error(op, "Cannot take the pointer address of '%s'", str);
gb_string_free(str);
}
o->mode = Addressing_Invalid;
@@ -1475,7 +1475,7 @@ void check_unary_expr(Checker *c, Operand *o, Token op, AstNode *node) {
if (!is_type_constant_type(o->type)) {
gbString xt = type_to_string(o->type);
gbString err_str = expr_to_string(node);
- error(op, "Invalid type, `%s`, for constant unary expression `%s`", xt, err_str);
+ error(op, "Invalid type, '%s', for constant unary expression '%s'", xt, err_str);
gb_string_free(err_str);
gb_string_free(xt);
o->mode = Addressing_Invalid;
@@ -1489,7 +1489,7 @@ void check_unary_expr(Checker *c, Operand *o, Token op, AstNode *node) {
}
if (op.kind == Token_Xor && is_type_untyped(type)) {
gbString err_str = expr_to_string(node);
- error(op, "Bitwise not cannot be applied to untyped constants `%s`", err_str);
+ error(op, "Bitwise not cannot be applied to untyped constants '%s'", err_str);
gb_string_free(err_str);
o->mode = Addressing_Invalid;
return;
@@ -1556,7 +1556,7 @@ void check_comparison(Checker *c, Operand *x, Operand *y, TokenKind op) {
}
gbString type_string = type_to_string(err_type);
err_str = gb_string_make(c->tmp_allocator,
- gb_bprintf("operator `%.*s` not defined for type `%s`", LIT(token_strings[op]), type_string));
+ gb_bprintf("operator '%.*s' not defined for type '%s'", LIT(token_strings[op]), type_string));
gb_string_free(type_string);
}
} else {
@@ -1572,7 +1572,7 @@ void check_comparison(Checker *c, Operand *x, Operand *y, TokenKind op) {
yt = type_to_string(y->type);
}
err_str = gb_string_make(c->tmp_allocator,
- gb_bprintf("mismatched types `%s` and `%s`", xt, yt));
+ gb_bprintf("mismatched types '%s' and '%s'", xt, yt));
gb_string_free(yt);
gb_string_free(xt);
}
@@ -1613,7 +1613,7 @@ void check_shift(Checker *c, Operand *x, Operand *y, AstNode *node) {
bool x_is_untyped = is_type_untyped(x->type);
if (!(is_type_integer(x->type) || (x_is_untyped && x_val.kind == ExactValue_Integer))) {
gbString err_str = expr_to_string(x->expr);
- error(node, "Shifted operand `%s` must be an integer", err_str);
+ error(node, "Shifted operand '%s' must be an integer", err_str);
gb_string_free(err_str);
x->mode = Addressing_Invalid;
return;
@@ -1629,7 +1629,7 @@ void check_shift(Checker *c, Operand *x, Operand *y, AstNode *node) {
}
} else {
gbString err_str = expr_to_string(y->expr);
- error(node, "Shift amount `%s` must be an unsigned integer", err_str);
+ error(node, "Shift amount '%s' must be an unsigned integer", err_str);
gb_string_free(err_str);
x->mode = Addressing_Invalid;
return;
@@ -1641,7 +1641,7 @@ void check_shift(Checker *c, Operand *x, Operand *y, AstNode *node) {
ExactValue y_val = exact_value_to_integer(y->value);
if (y_val.kind != ExactValue_Integer) {
gbString err_str = expr_to_string(y->expr);
- error(node, "Shift amount `%s` must be an unsigned integer", err_str);
+ error(node, "Shift amount '%s' must be an unsigned integer", err_str);
gb_string_free(err_str);
x->mode = Addressing_Invalid;
return;
@@ -1650,7 +1650,7 @@ void check_shift(Checker *c, Operand *x, Operand *y, AstNode *node) {
i64 amount = i128_to_i64(y_val.value_integer);
if (amount > 128) {
gbString err_str = expr_to_string(y->expr);
- error(node, "Shift amount too large: `%s`", err_str);
+ error(node, "Shift amount too large: '%s'", err_str);
gb_string_free(err_str);
x->mode = Addressing_Invalid;
return;
@@ -1684,13 +1684,13 @@ void check_shift(Checker *c, Operand *x, Operand *y, AstNode *node) {
if (y->mode == Addressing_Constant && i128_lt(y->value.value_integer, I128_ZERO)) {
gbString err_str = expr_to_string(y->expr);
- error(node, "Shift amount cannot be negative: `%s`", err_str);
+ error(node, "Shift amount cannot be negative: '%s'", err_str);
gb_string_free(err_str);
}
if (!is_type_integer(x->type)) {
gbString err_str = expr_to_string(y->expr);
- error(node, "Shift operand `%s` must be an integer", err_str);
+ error(node, "Shift operand '%s' must be an integer", err_str);
gb_string_free(err_str);
x->mode = Addressing_Invalid;
return;
@@ -1714,7 +1714,7 @@ Operand check_ptr_addition(Checker *c, TokenKind op, Operand *ptr, Operand *offs
if (base_type(ptr->type) == t_rawptr) {
gbString str = type_to_string(ptr->type);
- error(node, "Invalid pointer type for pointer arithmetic: `%s`", str);
+ error(node, "Invalid pointer type for pointer arithmetic: '%s'", str);
gb_string_free(str);
operand.mode = Addressing_Invalid;
return operand;
@@ -1726,7 +1726,7 @@ Operand check_ptr_addition(Checker *c, TokenKind op, Operand *ptr, Operand *offs
if (elem_size <= 0) {
gbString str = type_to_string(elem);
- error(node, "Size of pointer's element type `%s` is zero and cannot be used for pointer arithmetic", str);
+ error(node, "Size of pointer's element type '%s' is zero and cannot be used for pointer arithmetic", str);
gb_string_free(str);
operand.mode = Addressing_Invalid;
return operand;
@@ -1815,7 +1815,7 @@ bool check_is_castable_to(Checker *c, Operand *operand, Type *y) {
// NOTE(bill): This error should suppress the next casting error as it's at the same position
gbString xs = type_to_string(x);
gbString ys = type_to_string(y);
- error(operand->expr, "Cannot cast from a union pointer `%s` to `%s`, try using `union_cast` or cast to a `rawptr`", xs, ys);
+ error(operand->expr, "Cannot cast from a union pointer '%s' to '%s', try using 'union_cast' or cast to a 'rawptr'", xs, ys);
gb_string_free(ys);
gb_string_free(xs);
return false;
@@ -1887,7 +1887,7 @@ void check_cast(Checker *c, Operand *x, Type *type) {
gbString expr_str = expr_to_string(x->expr);
gbString to_type = type_to_string(type);
gbString from_type = type_to_string(x->type);
- error(x->expr, "Cannot cast `%s` as `%s` from `%s`", expr_str, to_type, from_type);
+ error(x->expr, "Cannot cast '%s' as '%s' from '%s'", expr_str, to_type, from_type);
gb_string_free(from_type);
gb_string_free(to_type);
gb_string_free(expr_str);
@@ -1910,7 +1910,7 @@ void check_cast(Checker *c, Operand *x, Type *type) {
bool check_transmute(Checker *c, AstNode *node, Operand *o, Type *t) {
if (o->mode == Addressing_Constant) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "Cannot transmute a constant expression: `%s`", expr_str);
+ error(o->expr, "Cannot transmute a constant expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -1919,7 +1919,7 @@ bool check_transmute(Checker *c, AstNode *node, Operand *o, Type *t) {
if (is_type_untyped(o->type)) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "Cannot transmute untyped expression: `%s`", expr_str);
+ error(o->expr, "Cannot transmute untyped expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -1931,7 +1931,7 @@ bool check_transmute(Checker *c, AstNode *node, Operand *o, Type *t) {
if (srcz != dstz) {
gbString expr_str = expr_to_string(o->expr);
gbString type_str = type_to_string(t);
- error(o->expr, "Cannot transmute `%s` to `%s`, %lld vs %lld bytes", expr_str, type_str, srcz, dstz);
+ error(o->expr, "Cannot transmute '%s' to '%s', %lld vs %lld bytes", expr_str, type_str, srcz, dstz);
gb_string_free(type_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
@@ -2015,7 +2015,7 @@ void check_binary_expr(Checker *c, Operand *x, AstNode *node) {
if (op.kind == Token_Sub) {
gbString lhs = expr_to_string(x->expr);
gbString rhs = expr_to_string(y->expr);
- error(node, "Invalid pointer arithmetic, did you mean `%s %.*s %s`?", rhs, LIT(op.string), lhs);
+ error(node, "Invalid pointer arithmetic, did you mean '%s %.*s %s'?", rhs, LIT(op.string), lhs);
gb_string_free(rhs);
gb_string_free(lhs);
x->mode = Addressing_Invalid;
@@ -2059,7 +2059,7 @@ void check_binary_expr(Checker *c, Operand *x, AstNode *node) {
gbString xt = type_to_string(x->type);
gbString yt = type_to_string(y->type);
gbString expr_str = expr_to_string(x->expr);
- error(op, "Mismatched types in binary expression `%s` : `%s` vs `%s`", expr_str, xt, yt);
+ error(op, "Mismatched types in binary expression '%s' : '%s' vs '%s'", expr_str, xt, yt);
gb_string_free(expr_str);
gb_string_free(yt);
gb_string_free(xt);
@@ -2121,7 +2121,7 @@ void check_binary_expr(Checker *c, Operand *x, AstNode *node) {
if (!is_type_constant_type(type)) {
gbString xt = type_to_string(x->type);
gbString err_str = expr_to_string(node);
- error(op, "Invalid type, `%s`, for constant binary expression `%s`", xt, err_str);
+ error(op, "Invalid type, '%s', for constant binary expression '%s'", xt, err_str);
gb_string_free(err_str);
gb_string_free(xt);
x->mode = Addressing_Invalid;
@@ -2161,7 +2161,7 @@ void update_expr_type(Checker *c, AstNode *e, Type *type, bool final) {
switch (e->kind) {
case_ast_node(ue, UnaryExpr, e);
if (old.value.kind != ExactValue_Invalid) {
- // NOTE(bill): if `e` is constant, the operands will be constant too.
+ // NOTE(bill): if 'e' is constant, the operands will be constant too.
// They don't need to be updated as they will be updated later and
// checked at the end of general checking stage.
break;
@@ -2226,11 +2226,11 @@ void convert_untyped_error(Checker *c, Operand *operand, Type *target_type) {
if (i128_eq(operand->value.value_integer, I128_ZERO)) {
if (make_string_c(expr_str) != "nil") { // HACK NOTE(bill): Just in case
// NOTE(bill): Doesn't matter what the type is as it's still zero in the union
- extra_text = " - Did you want `nil`?";
+ extra_text = " - Did you want 'nil'?";
}
}
}
- error(operand->expr, "Cannot convert `%s` to `%s`%s", expr_str, type_str, extra_text);
+ error(operand->expr, "Cannot convert '%s' to '%s'%s", expr_str, type_str, extra_text);
gb_string_free(type_str);
gb_string_free(expr_str);
@@ -2400,7 +2400,7 @@ void convert_to_typed(Checker *c, Operand *operand, Type *target_type) {
operand->mode = Addressing_Invalid;
convert_untyped_error(c, operand, target_type);
- gb_printf_err("Ambiguous type conversion to `%s`, which variant did you mean:\n\t", type_str);
+ gb_printf_err("Ambiguous type conversion to '%s', which variant did you mean:\n\t", type_str);
i32 j = 0;
for (i32 i = 0; i < valid_count; i++) {
ValidIndexAndScore valid = valids[i];
@@ -2410,7 +2410,7 @@ void convert_to_typed(Checker *c, Operand *operand, Type *target_type) {
gb_printf_err("or ");
}
gbString str = type_to_string(t->Union.variants[valid.index]);
- gb_printf_err("`%s`", str);
+ gb_printf_err("'%s'", str);
gb_string_free(str);
j++;
}
@@ -2423,7 +2423,7 @@ void convert_to_typed(Checker *c, Operand *operand, Type *target_type) {
operand->mode = Addressing_Invalid;
convert_untyped_error(c, operand, target_type);
if (count > 0) {
- gb_printf_err("`%s` is a union which only excepts the following types:\n", type_str);
+ gb_printf_err("'%s' is a union which only excepts the following types:\n", type_str);
gb_printf_err("\t");
for (i32 i = 0; i < count; i++) {
Type *v = t->Union.variants[i];
@@ -2433,7 +2433,7 @@ void convert_to_typed(Checker *c, Operand *operand, Type *target_type) {
gb_printf_err("or ");
}
gbString str = type_to_string(v);
- gb_printf_err("`%s`", str);
+ gb_printf_err("'%s'", str);
gb_string_free(str);
}
gb_printf_err("\n\n");
@@ -2478,7 +2478,7 @@ bool check_index_value(Checker *c, bool open_range, AstNode *index_value, i64 ma
if (!is_type_integer(operand.type)) {
gbString expr_str = expr_to_string(operand.expr);
- error(operand.expr, "Index `%s` must be an integer", expr_str);
+ error(operand.expr, "Index '%s' must be an integer", expr_str);
gb_string_free(expr_str);
if (value) *value = 0;
return false;
@@ -2489,7 +2489,7 @@ bool check_index_value(Checker *c, bool open_range, AstNode *index_value, i64 ma
i64 i = i128_to_i64(exact_value_to_integer(operand.value).value_integer);
if (i < 0) {
gbString expr_str = expr_to_string(operand.expr);
- error(operand.expr, "Index `%s` cannot be a negative value", expr_str);
+ error(operand.expr, "Index '%s' cannot be a negative value", expr_str);
gb_string_free(expr_str);
if (value) *value = 0;
return false;
@@ -2505,7 +2505,7 @@ bool check_index_value(Checker *c, bool open_range, AstNode *index_value, i64 ma
}
if (out_of_bounds) {
gbString expr_str = expr_to_string(operand.expr);
- error(operand.expr, "Index `%s` is out of bounds range 0..<%lld", expr_str, max_count);
+ error(operand.expr, "Index '%s' is out of bounds range 0..<%lld", expr_str, max_count);
gb_string_free(expr_str);
return false;
}
@@ -2573,7 +2573,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
if (selector->kind != AstNode_Ident && selector->kind != AstNode_BasicLit) {
// if (selector->kind != AstNode_Ident) {
- error(selector, "Illegal selector kind: `%.*s`", LIT(ast_node_strings[selector->kind]));
+ error(selector, "Illegal selector kind: '%.*s'", LIT(ast_node_strings[selector->kind]));
operand->mode = Addressing_Invalid;
operand->expr = node;
return nullptr;
@@ -2615,7 +2615,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
}
}
if (!is_declared) {
- error(op_expr, "`%.*s` is not declared by `%.*s`", LIT(entity_name), LIT(import_name));
+ error(op_expr, "'%.*s' is not declared by '%.*s'", LIT(entity_name), LIT(import_name));
operand->mode = Addressing_Invalid;
operand->expr = node;
return nullptr;
@@ -2699,7 +2699,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
if (is_not_exported) {
gbString sel_str = expr_to_string(selector);
- error(op_expr, "`%s` is not exported by `%.*s`", sel_str, LIT(import_name));
+ error(op_expr, "'%s' is not exported by '%.*s'", sel_str, LIT(import_name));
gb_string_free(sel_str);
operand->mode = Addressing_Invalid;
operand->expr = node;
@@ -2723,14 +2723,14 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
sel = lookup_field(c->allocator, operand->type, field_name, operand->mode == Addressing_Type);
if (operand->mode != Addressing_Type && !check_is_field_exported(c, sel.entity)) {
- error(op_expr, "`%.*s` is an unexported field", LIT(field_name));
+ error(op_expr, "'%.*s' is an unexported field", LIT(field_name));
operand->mode = Addressing_Invalid;
operand->expr = node;
return nullptr;
}
entity = sel.entity;
- // NOTE(bill): Add type info needed for fields like `names`
+ // NOTE(bill): Add type info needed for fields like 'names'
if (entity != nullptr && (entity->flags&EntityFlag_TypeField)) {
add_type_info_type(c, operand->type);
}
@@ -2797,7 +2797,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
gbString op_str = expr_to_string(op_expr);
gbString type_str = type_to_string(operand->type);
gbString sel_str = expr_to_string(selector);
- error(op_expr, "`%s` of type `%s` has no field `%s`", op_str, type_str, sel_str);
+ error(op_expr, "'%s' of type '%s' has no field '%s'", op_str, type_str, sel_str);
gb_string_free(sel_str);
gb_string_free(type_str);
gb_string_free(op_str);
@@ -2810,7 +2810,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
gbString op_str = expr_to_string(op_expr);
gbString type_str = type_to_string(operand->type);
gbString sel_str = expr_to_string(selector);
- error(op_expr, "Cannot access non-constant field `%s` from `%s`", sel_str, op_str);
+ error(op_expr, "Cannot access non-constant field '%s' from '%s'", sel_str, op_str);
gb_string_free(sel_str);
gb_string_free(type_str);
gb_string_free(op_str);
@@ -2875,7 +2875,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (err != nullptr) {
gbString expr = expr_to_string(ce->proc);
- error(ce->close, "%s arguments for `%s`, expected %td, got %td",
+ error(ce->close, "%s arguments for '%s', expected %td, got %td",
err, expr,
bp->arg_count, ce->args.count);
gb_string_free(expr);
@@ -2885,7 +2885,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (ce->args.count > 0) {
if (ce->args[0]->kind == AstNode_FieldValue) {
- error(call, "`field = value` calling is not allowed on built-in procedures");
+ error(call, "'field = value' calling is not allowed on built-in procedures");
return false;
}
}
@@ -2893,7 +2893,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
bool vari_expand = (ce->ellipsis.pos.line != 0);
// if (vari_expand && id != BuiltinProc_append) {
- // error(ce->ellipsis, "Invalid use of `...` with built-in procedure `append`");
+ // error(ce->ellipsis, "Invalid use of '...' with built-in procedure 'append'");
// return false;
// }
@@ -2924,7 +2924,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
String name = bd->name;
GB_ASSERT(name == "location");
if (ce->args.count > 1) {
- error(ce->args[0], "`#location` expects either 0 or 1 arguments, got %td", ce->args.count);
+ error(ce->args[0], "'#location' expects either 0 or 1 arguments, got %td", ce->args.count);
}
if (ce->args.count > 0) {
AstNode *arg = ce->args[0];
@@ -2936,7 +2936,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
e = check_selector(c, &o, arg, nullptr);
}
if (e == nullptr) {
- error(ce->args[0], "`#location` expected a valid entity name");
+ error(ce->args[0], "'#location' expected a valid entity name");
}
}
@@ -2985,7 +2985,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (mode == Addressing_Invalid) {
String name = builtin_procs[id].name;
gbString t = type_to_string(operand->type);
- error(call, "`%.*s` is not supported for `%s`", LIT(name), t);
+ error(call, "'%.*s' is not supported for '%s'", LIT(name), t);
return false;
}
@@ -3003,7 +3003,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
check_expr_or_type(c, &op, ce->args[0]);
Type *type = op.type;
if ((op.mode != Addressing_Type && type == nullptr) || type == t_invalid) {
- error(ce->args[0], "Expected a type for `new`");
+ error(ce->args[0], "Expected a type for 'new'");
return false;
}
operand->mode = Addressing_Value;
@@ -3020,13 +3020,13 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
check_expr_or_type(c, &op, ce->args[0]);
Type *type = op.type;
if ((op.mode != Addressing_Type && type == nullptr) || type == t_invalid) {
- error(ce->args[0], "Expected a type for `new_slice`");
+ error(ce->args[0], "Expected a type for 'new_slice'");
return false;
}
isize arg_count = ce->args.count;
if (arg_count < 2 || 3 < arg_count) {
- error(ce->args[0], "`new_slice` expects 2 or 3 arguments, found %td", arg_count);
+ error(ce->args[0], "'new_slice' expects 2 or 3 arguments, found %td", arg_count);
// NOTE(bill): Return the correct type to reduce errors
} else {
// If any are constant
@@ -3042,7 +3042,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
if (size_count == 2 && sizes[0] > sizes[1]) {
- error(ce->args[1], "`new_slice` count and capacity are swapped");
+ error(ce->args[1], "'new_slice' count and capacity are swapped");
// No need quit
}
}
@@ -3060,7 +3060,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
check_expr_or_type(c, &op, ce->args[0]);
Type *type = op.type;
if ((op.mode != Addressing_Type && type == nullptr) || type == t_invalid) {
- error(ce->args[0], "Expected a type for `make`");
+ error(ce->args[0], "Expected a type for 'make'");
return false;
}
@@ -3077,14 +3077,14 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
max_args = 3;
} else {
gbString str = type_to_string(type);
- error(call, "Cannot `make` %s; type must be a slice, map, or dynamic array", str);
+ error(call, "Cannot 'make' %s; type must be a slice, map, or dynamic array", str);
gb_string_free(str);
return false;
}
isize arg_count = ce->args.count;
if (arg_count < min_args || max_args < arg_count) {
- error(ce->args[0], "`make` expects %td or %d argument, found %td", min_args, max_args, arg_count);
+ error(ce->args[0], "'make' expects %td or %d argument, found %td", min_args, max_args, arg_count);
return false;
}
@@ -3101,7 +3101,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
if (size_count == 2 && sizes[0] > sizes[1]) {
- error(ce->args[1], "`make` count and capacity are swapped");
+ error(ce->args[1], "'make' count and capacity are swapped");
// No need quit
}
@@ -3133,7 +3133,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!ok) {
gbString type_str = type_to_string(type);
- error(operand->expr, "Invalid type for `free`, got `%s`", type_str);
+ error(operand->expr, "Invalid type for 'free', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3153,7 +3153,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
Type *type = operand->type;
if (!is_type_dynamic_array(type) && !is_type_dynamic_map(type)) {
gbString str = type_to_string(type);
- error(operand->expr, "Expected a dynamic array or dynamic map, got `%s`", str);
+ error(operand->expr, "Expected a dynamic array or dynamic map, got '%s'", str);
gb_string_free(str);
return false;
}
@@ -3166,7 +3166,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
Type *arg_type = base_type(op.type);
if (!is_type_integer(arg_type)) {
- error(operand->expr, "`reserve` capacities must be an integer");
+ error(operand->expr, "'reserve' capacities must be an integer");
return false;
}
@@ -3183,7 +3183,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
type = base_type(type_deref(type));
if (!is_type_dynamic_array(type) && !is_type_map(type) && !is_type_slice(type)) {
gbString str = type_to_string(type);
- error(operand->expr, "Invalid type for `clear`, got `%s`", str);
+ error(operand->expr, "Invalid type for 'clear', got '%s'", str);
gb_string_free(str);
return false;
}
@@ -3205,7 +3205,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
type = base_type(type_deref(type));
if (!is_type_dynamic_array(type) && !is_type_slice(type)) {
gbString str = type_to_string(type);
- error(operand->expr, "Expected a slice or dynamic array, got `%s`", str);
+ error(operand->expr, "Expected a slice or dynamic array, got '%s'", str);
gb_string_free(str);
return false;
}
@@ -3215,7 +3215,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
is_addressable = true;
}
if (!is_addressable) {
- error(operand->expr, "`append` can only operate on addressable values");
+ error(operand->expr, "'append' can only operate on addressable values");
return false;
}
@@ -3251,7 +3251,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
Type *type = operand->type;
if (!is_type_map(type)) {
gbString str = type_to_string(type);
- error(operand->expr, "Expected a map, got `%s`", str);
+ error(operand->expr, "Expected a map, got '%s'", str);
gb_string_free(str);
return false;
}
@@ -3268,7 +3268,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!check_is_assignable_to(c, &op, key)) {
gbString kt = type_to_string(key);
gbString ot = type_to_string(op.type);
- error(operand->expr, "Expected a key of type `%s`, got `%s`", key, ot);
+ error(operand->expr, "Expected a key of type '%s', got '%s'", key, ot);
gb_string_free(ot);
gb_string_free(kt);
return false;
@@ -3290,7 +3290,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
Type *t = o.type;
if (t == nullptr || t == t_invalid) {
- error(ce->args[0], "Invalid argument for `size_of`");
+ error(ce->args[0], "Invalid argument for 'size_of'");
return false;
}
t = default_type(t);
@@ -3311,7 +3311,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
Type *t = o.type;
if (t == nullptr || t == t_invalid) {
- error(ce->args[0], "Invalid argument for `align_of`");
+ error(ce->args[0], "Invalid argument for 'align_of'");
return false;
}
t = default_type(t);
@@ -3330,7 +3330,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
Type *bt = check_type(c, ce->args[0]);
Type *type = base_type(bt);
if (type == nullptr || type == t_invalid) {
- error(ce->args[0], "Expected a type for `offset_of`");
+ error(ce->args[0], "Expected a type for 'offset_of'");
return false;
}
@@ -3341,7 +3341,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
return false;
}
if (is_type_array(type) || is_type_vector(type)) {
- error(field_arg, "Invalid type for `offset_of`");
+ error(field_arg, "Invalid type for 'offset_of'");
return false;
}
@@ -3351,14 +3351,14 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (sel.entity == nullptr) {
gbString type_str = type_to_string(bt);
error(ce->args[0],
- "`%s` has no field named `%.*s`", type_str, LIT(arg->token.string));
+ "'%s' has no field named '%.*s'", type_str, LIT(arg->token.string));
gb_string_free(type_str);
return false;
}
if (sel.indirect) {
gbString type_str = type_to_string(bt);
error(ce->args[0],
- "Field `%.*s` is embedded via a pointer in `%s`", LIT(arg->token.string), type_str);
+ "Field '%.*s' is embedded via a pointer in '%s'", LIT(arg->token.string), type_str);
gb_string_free(type_str);
return false;
}
@@ -3373,16 +3373,16 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
case BuiltinProc_type_of:
// proc type_of(val: Type) -> type(Type)
- check_assignment(c, operand, nullptr, str_lit("argument of `type_of`"));
+ check_assignment(c, operand, nullptr, str_lit("argument of 'type_of'"));
if (operand->mode == Addressing_Invalid || operand->mode == Addressing_Builtin) {
return false;
}
if (operand->type == nullptr || operand->type == t_invalid) {
- error(operand->expr, "Invalid argument to `type_of`");
+ error(operand->expr, "Invalid argument to 'type_of'");
return false;
}
if (is_type_polymorphic(operand->type)) {
- error(operand->expr, "`type_of` of polymorphic type cannot be determined");
+ error(operand->expr, "'type_of' of polymorphic type cannot be determined");
return false;
}
operand->mode = Addressing_Type;
@@ -3392,7 +3392,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
case BuiltinProc_type_info_of: {
// proc type_info_of(Type) -> ^Type_Info
if (c->context.scope->is_global) {
- compiler_error("`type_info_of` Cannot be declared within a #shared_global_scope due to how the internals of the compiler works");
+ compiler_error("'type_info_of' Cannot be declared within a #shared_global_scope due to how the internals of the compiler works");
}
// NOTE(bill): The type information may not be setup yet
@@ -3405,7 +3405,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
Type *t = o.type;
if (t == nullptr || t == t_invalid || is_type_polymorphic(operand->type)) {
- error(ce->args[0], "Invalid argument for `type_info_of`");
+ error(ce->args[0], "Invalid argument for 'type_info_of'");
return false;
}
t = default_type(t);
@@ -3423,13 +3423,13 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!is_type_boolean(operand->type) && operand->mode != Addressing_Constant) {
gbString str = expr_to_string(ce->args[0]);
- error(call, "`%s` is not a constant boolean", str);
+ error(call, "'%s' is not a constant boolean", str);
gb_string_free(str);
return false;
}
if (!operand->value.value_bool) {
gbString str = expr_to_string(ce->args[0]);
- error(call, "Compile time assertion: `%s`", str);
+ error(call, "Compile time assertion: '%s'", str);
gb_string_free(str);
}
@@ -3444,7 +3444,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!is_type_vector(type) && !is_type_array(type)) {
gbString type_str = type_to_string(operand->type);
error(call,
- "You can only `swizzle` a vector or array, got `%s`",
+ "You can only 'swizzle' a vector or array, got '%s'",
type_str);
gb_string_free(type_str);
return false;
@@ -3476,17 +3476,17 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
Type *arg_type = base_type(op.type);
if (!is_type_integer(arg_type) || op.mode != Addressing_Constant) {
- error(op.expr, "Indices to `swizzle` must be constant integers");
+ error(op.expr, "Indices to 'swizzle' must be constant integers");
return false;
}
if (op.value.value_integer < I128_ZERO) {
- error(op.expr, "Negative `swizzle` index");
+ error(op.expr, "Negative 'swizzle' index");
return false;
}
if (max_count128 <= op.value.value_integer) {
- error(op.expr, "`swizzle` index exceeds length");
+ error(op.expr, "'swizzle' index exceeds length");
return false;
}
@@ -3494,7 +3494,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
if (arg_count > max_count) {
- error(call, "Too many `swizzle` indices, %td > %td", arg_count, max_count);
+ error(call, "Too many 'swizzle' indices, %td > %td", arg_count, max_count);
return false;
}
@@ -3540,7 +3540,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!are_types_identical(x.type, y.type)) {
gbString tx = type_to_string(x.type);
gbString ty = type_to_string(y.type);
- error(call, "Mismatched types to `complex`, `%s` vs `%s`", tx, ty);
+ error(call, "Mismatched types to 'complex', '%s' vs '%s'", tx, ty);
gb_string_free(ty);
gb_string_free(tx);
return false;
@@ -3548,7 +3548,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!is_type_float(x.type)) {
gbString s = type_to_string(x.type);
- error(call, "Arguments have type `%s`, expected a floating point", s);
+ error(call, "Arguments have type '%s', expected a floating point", s);
gb_string_free(s);
return false;
}
@@ -3593,7 +3593,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
if (!is_type_complex(x->type)) {
gbString s = type_to_string(x->type);
- error(call, "Argument has type `%s`, expected a complex type", s);
+ error(call, "Argument has type '%s', expected a complex type", s);
gb_string_free(s);
return false;
}
@@ -3633,7 +3633,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
}
} else {
gbString s = type_to_string(x->type);
- error(call, "Expected a complex or quaternion, got `%s`", s);
+ error(call, "Expected a complex or quaternion, got '%s'", s);
gb_string_free(s);
return false;
}
@@ -3650,19 +3650,19 @@ break;
Type *ptr_type = base_type(operand->type);
if (!is_type_pointer(ptr_type)) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a pointer to `slice_ptr`, got `%s`", type_str);
+ error(call, "Expected a pointer to 'slice_ptr', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
if (ptr_type == t_rawptr) {
- error(call, "`rawptr` cannot have pointer arithmetic");
+ error(call, "'rawptr' cannot have pointer arithmetic");
return false;
}
isize arg_count = ce->args.count;
if (arg_count < 2 || 3 < arg_count) {
- error(ce->args[0], "`slice_ptr` expects 2 or 3 arguments, found %td", arg_count);
+ error(ce->args[0], "'slice_ptr' expects 2 or 3 arguments, found %td", arg_count);
// NOTE(bill): Return the correct type to reduce errors
} else {
// If any are constant
@@ -3678,7 +3678,7 @@ break;
}
if (size_count == 2 && sizes[0] > sizes[1]) {
- error(ce->args[1], "`slice_ptr` count and capacity are swapped");
+ error(ce->args[1], "'slice_ptr' count and capacity are swapped");
// No need quit
}
}
@@ -3693,7 +3693,7 @@ break;
Type *slice_type = base_type(operand->type);
if (!is_type_slice(slice_type)) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a slice type, got `%s`", type_str);
+ error(call, "Expected a slice type, got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3709,7 +3709,7 @@ break;
if (!is_type_struct(type) &
!is_type_union(type)) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a struct or union type, got `%s`", type_str);
+ error(call, "Expected a struct or union type, got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3732,7 +3732,7 @@ break;
Type *type = base_type(operand->type);
if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a ordered numeric type to `min`, got `%s`", type_str);
+ error(call, "Expected a ordered numeric type to 'min', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3747,7 +3747,7 @@ break;
if (!is_type_ordered(b.type) || !(is_type_numeric(b.type) || is_type_string(b.type))) {
gbString type_str = type_to_string(b.type);
error(call,
- "Expected a ordered numeric type to `min`, got `%s`",
+ "Expected a ordered numeric type to 'min', got '%s'",
type_str);
gb_string_free(type_str);
return false;
@@ -3783,7 +3783,7 @@ break;
gbString type_a = type_to_string(a.type);
gbString type_b = type_to_string(b.type);
error(call,
- "Mismatched types to `min`, `%s` vs `%s`",
+ "Mismatched types to 'min', '%s' vs '%s'",
type_a, type_b);
gb_string_free(type_b);
gb_string_free(type_a);
@@ -3801,7 +3801,7 @@ break;
if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
gbString type_str = type_to_string(operand->type);
error(call,
- "Expected a ordered numeric or string type to `max`, got `%s`",
+ "Expected a ordered numeric or string type to 'max', got '%s'",
type_str);
gb_string_free(type_str);
return false;
@@ -3817,7 +3817,7 @@ break;
if (!is_type_ordered(b.type) || !(is_type_numeric(b.type) || is_type_string(b.type))) {
gbString type_str = type_to_string(b.type);
error(call,
- "Expected a ordered numeric or string type to `max`, got `%s`",
+ "Expected a ordered numeric or string type to 'max', got '%s'",
type_str);
gb_string_free(type_str);
return false;
@@ -3853,7 +3853,7 @@ break;
gbString type_a = type_to_string(a.type);
gbString type_b = type_to_string(b.type);
error(call,
- "Mismatched types to `max`, `%s` vs `%s`",
+ "Mismatched types to 'max', '%s' vs '%s'",
type_a, type_b);
gb_string_free(type_b);
gb_string_free(type_a);
@@ -3869,7 +3869,7 @@ break;
// proc abs(n: numeric) -> numeric
if (!is_type_numeric(operand->type) && !is_type_vector(operand->type)) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a numeric type to `abs`, got `%s`", type_str);
+ error(call, "Expected a numeric type to 'abs', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3910,7 +3910,7 @@ break;
Type *type = base_type(operand->type);
if (!is_type_ordered(type) || !(is_type_numeric(type) || is_type_string(type))) {
gbString type_str = type_to_string(operand->type);
- error(call, "Expected a ordered numeric or string type to `clamp`, got `%s`", type_str);
+ error(call, "Expected a ordered numeric or string type to 'clamp', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3927,7 +3927,7 @@ break;
}
if (!is_type_ordered(y.type) || !(is_type_numeric(y.type) || is_type_string(y.type))) {
gbString type_str = type_to_string(y.type);
- error(call, "Expected a ordered numeric or string type to `clamp`, got `%s`", type_str);
+ error(call, "Expected a ordered numeric or string type to 'clamp', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3938,7 +3938,7 @@ break;
}
if (!is_type_ordered(z.type) || !(is_type_numeric(z.type) || is_type_string(z.type))) {
gbString type_str = type_to_string(z.type);
- error(call, "Expected a ordered numeric or string type to `clamp`, got `%s`", type_str);
+ error(call, "Expected a ordered numeric or string type to 'clamp', got '%s'", type_str);
gb_string_free(type_str);
return false;
}
@@ -3983,7 +3983,7 @@ break;
gbString type_y = type_to_string(y.type);
gbString type_z = type_to_string(z.type);
error(call,
- "Mismatched types to `clamp`, `%s`, `%s`, `%s`",
+ "Mismatched types to 'clamp', '%s', '%s', '%s'",
type_x, type_y, type_z);
gb_string_free(type_z);
gb_string_free(type_y);
@@ -4001,7 +4001,7 @@ break;
check_expr_or_type(c, &op, ce->args[0]);
Type *t = op.type;
if ((op.mode != Addressing_Type && t == nullptr) || t == t_invalid) {
- error(ce->args[0], "Expected a type for `transmute`");
+ error(ce->args[0], "Expected a type for 'transmute'");
return false;
}
AstNode *expr = ce->args[1];
@@ -4013,7 +4013,7 @@ break;
if (o->mode == Addressing_Constant) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "Cannot transmute a constant expression: `%s`", expr_str);
+ error(o->expr, "Cannot transmute a constant expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = expr;
@@ -4022,7 +4022,7 @@ break;
if (is_type_untyped(o->type)) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "Cannot transmute untyped expression: `%s`", expr_str);
+ error(o->expr, "Cannot transmute untyped expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = expr;
@@ -4034,7 +4034,7 @@ break;
if (srcz != dstz) {
gbString expr_str = expr_to_string(o->expr);
gbString type_str = type_to_string(t);
- error(o->expr, "Cannot transmute `%s` to `%s`, %lld vs %lld bytes", expr_str, type_str, srcz, dstz);
+ error(o->expr, "Cannot transmute '%s' to '%s', %lld vs %lld bytes", expr_str, type_str, srcz, dstz);
gb_string_free(type_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
@@ -4060,7 +4060,7 @@ isize add_dependencies_from_unpacking(Checker *c, Entity **lhs, isize lhs_count,
Entity *e = lhs[tuple_index + j];
DeclInfo *decl = decl_info_of_entity(&c->info, e);
if (decl != nullptr) {
- c->context.decl = decl; // will be reset by the `defer` any way
+ c->context.decl = decl; // will be reset by the 'defer' any way
for_array(k, decl->deps.entries) {
Entity *dep = decl->deps.entries[k].ptr;
add_declaration_dependency(c, dep); // TODO(bill): Should this be here?
@@ -4203,14 +4203,14 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) {
if (vari_expand && !variadic) {
if (show_error) {
error(ce->ellipsis,
- "Cannot use `...` in call to a non-variadic procedure: `%.*s`",
+ "Cannot use '...' in call to a non-variadic procedure: '%.*s'",
LIT(ce->proc->Ident.token.string));
}
err = CallArgumentError_NonVariadicExpand;
} else if (vari_expand && pt->c_vararg) {
if (show_error) {
error(ce->ellipsis,
- "Cannot use `...` in call to a `#c_vararg` variadic procedure: `%.*s`",
+ "Cannot use '...' in call to a '#c_vararg' variadic procedure: '%.*s'",
LIT(ce->proc->Ident.token.string));
}
err = CallArgumentError_NonVariadicExpand;
@@ -4225,10 +4225,10 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) {
}
if (error_code != 0) {
err = CallArgumentError_TooManyArguments;
- char *err_fmt = "Too many arguments for `%s`, expected %td arguments";
+ char *err_fmt = "Too many arguments for '%s', expected %td arguments";
if (error_code < 0) {
err = CallArgumentError_TooFewArguments;
- err_fmt = "Too few arguments for `%s`, expected %td arguments";
+ err_fmt = "Too few arguments for '%s', expected %td arguments";
}
if (show_error) {
@@ -4265,7 +4265,7 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) {
continue;
} else if (o.mode != Addressing_Type) {
if (show_error) {
- error(o.expr, "Expected a type for the argument `%.*s`", LIT(e->token.string));
+ error(o.expr, "Expected a type for the argument '%.*s'", LIT(e->token.string));
}
err = CallArgumentError_WrongTypes;
}
@@ -4303,7 +4303,7 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) {
t = slice;
if (operand_index != param_count) {
if (show_error) {
- error(o.expr, "`...` in a variadic procedure can only have one variadic argument at the end");
+ error(o.expr, "'...' in a variadic procedure can only have one variadic argument at the end");
}
if (data) {
data->score = score;
@@ -4397,7 +4397,7 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
if (fv->field->kind != AstNode_Ident) {
if (show_error) {
gbString expr_str = expr_to_string(fv->field);
- error(arg, "Invalid parameter name `%s` in procedure call", expr_str);
+ error(arg, "Invalid parameter name '%s' in procedure call", expr_str);
gb_string_free(expr_str);
}
err = CallArgumentError_InvalidFieldValue;
@@ -4407,14 +4407,14 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
isize index = lookup_procedure_parameter(pt, name);
if (index < 0) {
if (show_error) {
- error(arg, "No parameter named `%.*s` for this procedure type", LIT(name));
+ error(arg, "No parameter named '%.*s' for this procedure type", LIT(name));
}
err = CallArgumentError_ParameterNotFound;
continue;
}
if (visited[index]) {
if (show_error) {
- error(arg, "Duplicate parameter `%.*s` in procedure call", LIT(name));
+ error(arg, "Duplicate parameter '%.*s' in procedure call", LIT(name));
}
err = CallArgumentError_DuplicateParameter;
continue;
@@ -4447,13 +4447,13 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
if (show_error) {
if (e->kind == Entity_TypeName) {
- error(call, "Type parameter `%.*s` is missing in procedure call",
+ error(call, "Type parameter '%.*s' is missing in procedure call",
LIT(e->token.string));
} else if (e->kind == Entity_Constant && e->Constant.value.kind != ExactValue_Invalid) {
// Ignore
} else {
gbString str = type_to_string(e->type);
- error(call, "Parameter `%.*s` of type `%s` is missing in procedure call",
+ error(call, "Parameter '%.*s' of type '%s' is missing in procedure call",
LIT(e->token.string), str);
gb_string_free(str);
}
@@ -4485,7 +4485,7 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
GB_ASSERT(pt->is_polymorphic);
if (o->mode != Addressing_Type) {
if (show_error) {
- error(o->expr, "Expected a type for the argument `%.*s`", LIT(e->token.string));
+ error(o->expr, "Expected a type for the argument '%.*s'", LIT(e->token.string));
}
err = CallArgumentError_WrongTypes;
}
@@ -4537,7 +4537,7 @@ CallArgumentData check_call_arguments(Checker *c, Operand *operand, Type *proc_t
bool vari_expand = (ce->ellipsis.pos.line != 0);
if (vari_expand) {
- // error(ce->ellipsis, "Invalid use of `...` with `field = value` call`");
+ // error(ce->ellipsis, "Invalid use of '...' with 'field = value' call'");
}
} else {
@@ -4605,7 +4605,7 @@ CallArgumentData check_call_arguments(Checker *c, Operand *operand, Type *proc_t
if (valid_count == 0) {
- error(operand->expr, "No overloads or ambiguous call for `%.*s` that match with the given arguments", LIT(name));
+ error(operand->expr, "No overloads or ambiguous call for '%.*s' that match with the given arguments", LIT(name));
gb_printf_err("\tGiven argument types -> (");
for_array(i, operands) {
Operand o = operands[i];
@@ -4640,7 +4640,7 @@ CallArgumentData check_call_arguments(Checker *c, Operand *operand, Type *proc_t
}
result_type = t_invalid;
} else if (valid_count > 1) {
- error(operand->expr, "Ambiguous procedure call `%.*s` tha match with the given arguments", LIT(name));
+ error(operand->expr, "Ambiguous procedure call '%.*s' tha match with the given arguments", LIT(name));
gb_printf_err("\tGiven argument types -> (");
for_array(i, operands) {
Operand o = operands[i];
@@ -4777,7 +4777,7 @@ CallArgumentError check_polymorphic_struct_type(Checker *c, Operand *operand, As
bool vari_expand = (ce->ellipsis.pos.line != 0);
if (vari_expand) {
- error(ce->ellipsis, "Invalid use of `...` in a polymorphic type call`");
+ error(ce->ellipsis, "Invalid use of '...' in a polymorphic type call'");
}
} else {
@@ -4802,7 +4802,7 @@ CallArgumentError check_polymorphic_struct_type(Checker *c, Operand *operand, As
if (fv->field->kind != AstNode_Ident) {
if (show_error) {
gbString expr_str = expr_to_string(fv->field);
- error(arg, "Invalid parameter name `%s` in polymorphic type call", expr_str);
+ error(arg, "Invalid parameter name '%s' in polymorphic type call", expr_str);
gb_string_free(expr_str);
}
err = CallArgumentError_InvalidFieldValue;
@@ -4812,14 +4812,14 @@ CallArgumentError check_polymorphic_struct_type(Checker *c, Operand *operand, As
isize index = lookup_polymorphic_struct_parameter(st, name);
if (index < 0) {
if (show_error) {
- error(arg, "No parameter named `%.*s` for this polymorphic type", LIT(name));
+ error(arg, "No parameter named '%.*s' for this polymorphic type", LIT(name));
}
err = CallArgumentError_ParameterNotFound;
continue;
}
if (visited[index]) {
if (show_error) {
- error(arg, "Duplicate parameter `%.*s` in polymorphic type", LIT(name));
+ error(arg, "Duplicate parameter '%.*s' in polymorphic type", LIT(name));
}
err = CallArgumentError_DuplicateParameter;
continue;
@@ -4838,11 +4838,11 @@ CallArgumentError check_polymorphic_struct_type(Checker *c, Operand *operand, As
if (show_error) {
if (e->kind == Entity_TypeName) {
- error(call, "Type parameter `%.*s` is missing in polymorphic type call",
+ error(call, "Type parameter '%.*s' is missing in polymorphic type call",
LIT(e->token.string));
} else {
gbString str = type_to_string(e->type);
- error(call, "Parameter `%.*s` of type `%s` is missing in polymorphic type call",
+ error(call, "Parameter '%.*s' of type '%s' is missing in polymorphic type call",
LIT(e->token.string), str);
gb_string_free(str);
}
@@ -4868,7 +4868,7 @@ CallArgumentError check_polymorphic_struct_type(Checker *c, Operand *operand, As
if (e->kind == Entity_TypeName) {
if (o->mode != Addressing_Type) {
if (show_error) {
- error(o->expr, "Expected a type for the argument `%.*s`", LIT(e->token.string));
+ error(o->expr, "Expected a type for the argument '%.*s'", LIT(e->token.string));
}
err = CallArgumentError_WrongTypes;
}
@@ -4967,7 +4967,7 @@ ExprKind check_call_expr(Checker *c, Operand *operand, AstNode *call) {
mix = arg->kind == AstNode_FieldValue;
}
if (mix) {
- error(arg, "Mixture of `field = value` and value elements in a procedure all is not allowed");
+ error(arg, "Mixture of 'field = value' and value elements in a procedure all is not allowed");
fail = true;
}
}
@@ -5017,12 +5017,12 @@ ExprKind check_call_expr(Checker *c, Operand *operand, AstNode *call) {
operand->mode = Addressing_Invalid;
isize arg_count = ce->args.count;
switch (arg_count) {
- case 0: error(call, "Missing argument in conversion to `%s`", str); break;
- default: error(call, "Too many arguments in conversion to `%s`", str); break;
+ case 0: error(call, "Missing argument in conversion to '%s'", str); break;
+ default: error(call, "Too many arguments in conversion to '%s'", str); break;
case 1: {
AstNode *arg = ce->args[0];
if (arg->kind == AstNode_FieldValue) {
- error(call, "`field = value` cannot be used in a type conversion");
+ error(call, "'field = value' cannot be used in a type conversion");
arg = arg->FieldValue.value;
// NOTE(bill): Carry on the cast regardless
}
@@ -5055,7 +5055,7 @@ ExprKind check_call_expr(Checker *c, Operand *operand, AstNode *call) {
AstNode *e = operand->expr;
gbString str = expr_to_string(e);
gbString type_str = type_to_string(operand->type);
- error(e, "Cannot call a non-procedure: `%s` of type `%s`", str, type_str);
+ error(e, "Cannot call a non-procedure: '%s' of type '%s'", str, type_str);
gb_string_free(type_str);
gb_string_free(str);
@@ -5120,7 +5120,7 @@ void check_expr_with_type_hint(Checker *c, Operand *o, AstNode *e, Type *t) {
}
if (err_str != nullptr) {
gbString str = expr_to_string(e);
- error(e, "`%s` %s", str, err_str);
+ error(e, "'%s' %s", str, err_str);
gb_string_free(str);
o->mode = Addressing_Invalid;
}
@@ -5212,7 +5212,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
switch (i->kind) {
case Token_context:
if (c->context.proc_name.len == 0) {
- error(node, "`context` is only allowed within procedures");
+ error(node, "'context' is only allowed within procedures");
return kind;
}
@@ -5243,7 +5243,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
break;
default:
- error(node, "Illegal implicit name `%.*s`", LIT(i->string));
+ error(node, "Illegal implicit name '%.*s'", LIT(i->string));
return kind;
}
case_end;
@@ -5326,7 +5326,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
check_procedure_type(c, type, pl->type);
if (!is_type_proc(type)) {
gbString str = expr_to_string(node);
- error(node, "Invalid procedure literal `%s`", str);
+ error(node, "Invalid procedure literal '%s'", str);
gb_string_free(str);
check_close_scope(c);
return kind;
@@ -5456,7 +5456,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
Type *t = base_type(type);
if (is_type_polymorphic(t)) {
gbString str = type_to_string(type);
- error(node, "Cannot use a polymorphic type for a compound literal, got `%s`", str);
+ error(node, "Cannot use a polymorphic type for a compound literal, got '%s'", str);
o->expr = node;
o->type = type;
gb_string_free(str);
@@ -5475,7 +5475,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (!is_type_struct(t)) {
if (cl->elems.count != 0) {
gbString type_str = type_to_string(type);
- error(node, "Illegal compound literal type `%s`", type_str);
+ error(node, "Illegal compound literal type '%s'", type_str);
gb_string_free(type_str);
}
break;
@@ -5504,13 +5504,13 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
for_array(i, cl->elems) {
AstNode *elem = cl->elems[i];
if (elem->kind != AstNode_FieldValue) {
- error(elem, "Mixture of `field = value` and value elements in a literal is not allowed");
+ error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
continue;
}
ast_node(fv, FieldValue, elem);
if (fv->field->kind != AstNode_Ident) {
gbString expr_str = expr_to_string(fv->field);
- error(elem, "Invalid field name `%s` in structure literal", expr_str);
+ error(elem, "Invalid field name '%s' in structure literal", expr_str);
gb_string_free(expr_str);
continue;
}
@@ -5519,17 +5519,17 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
Selection sel = lookup_field(c->allocator, type, name, o->mode == Addressing_Type);
bool is_unknown = sel.entity == nullptr;
if (is_unknown) {
- error(elem, "Unknown field `%.*s` in structure literal", LIT(name));
+ error(elem, "Unknown field '%.*s' in structure literal", LIT(name));
continue;
}
if (!is_unknown && !check_is_field_exported(c, sel.entity)) {
- error(elem, "Cannot assign to an unexported field `%.*s` in structure literal", LIT(name));
+ error(elem, "Cannot assign to an unexported field '%.*s' in structure literal", LIT(name));
continue;
}
if (sel.index.count > 1) {
- error(elem, "Cannot assign to an anonymous field `%.*s` in a structure literal (at the moment)", LIT(name));
+ error(elem, "Cannot assign to an anonymous field '%.*s' in a structure literal (at the moment)", LIT(name));
continue;
}
@@ -5537,7 +5537,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
add_entity_use(c, fv->field, field);
if (fields_visited[sel.index[0]]) {
- error(elem, "Duplicate field `%.*s` in structure literal", LIT(name));
+ error(elem, "Duplicate field '%.*s' in structure literal", LIT(name));
continue;
}
@@ -5571,10 +5571,10 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
AstNode *elem = cl->elems[index];
if (elem->kind == AstNode_FieldValue) {
seen_field_value = true;
- // error(elem, "Mixture of `field = value` and value elements in a literal is not allowed");
+ // error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
// continue;
} else if (seen_field_value) {
- error(elem, "Value elements cannot be used after a `field = value`");
+ error(elem, "Value elements cannot be used after a 'field = value'");
continue;
}
if (index >= field_count) {
@@ -5594,7 +5594,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (!check_is_field_exported(c, field)) {
gbString t = type_to_string(type);
- error(o->expr, "Implicit assignment to an unexported field `%.*s` in `%s` literal",
+ error(o->expr, "Implicit assignment to an unexported field '%.*s' in '%s' literal",
LIT(field->token.string), t);
gb_string_free(t);
continue;
@@ -5669,7 +5669,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
}
if (e->kind == AstNode_FieldValue) {
- error(e, "`field = value` is only allowed in struct literals");
+ error(e, "'field = value' is only allowed in struct literals");
continue;
}
@@ -5721,13 +5721,13 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
for_array(i, cl->elems) {
AstNode *elem = cl->elems[i];
if (elem->kind != AstNode_FieldValue) {
- error(elem, "Mixture of `field = value` and value elements in a `any` literal is not allowed");
+ error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
continue;
}
ast_node(fv, FieldValue, elem);
if (fv->field->kind != AstNode_Ident) {
gbString expr_str = expr_to_string(fv->field);
- error(elem, "Invalid field name `%s` in `any` literal", expr_str);
+ error(elem, "Invalid field name '%s' in 'any' literal", expr_str);
gb_string_free(expr_str);
continue;
}
@@ -5735,47 +5735,47 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
Selection sel = lookup_field(c->allocator, type, name, o->mode == Addressing_Type);
if (sel.entity == nullptr) {
- error(elem, "Unknown field `%.*s` in `any` literal", LIT(name));
+ error(elem, "Unknown field '%.*s' in 'any' literal", LIT(name));
continue;
}
isize index = sel.index[0];
if (fields_visited[index]) {
- error(elem, "Duplicate field `%.*s` in `any` literal", LIT(name));
+ error(elem, "Duplicate field '%.*s' in 'any' literal", LIT(name));
continue;
}
fields_visited[index] = true;
check_expr(c, o, fv->value);
- // NOTE(bill): `any` literals can never be constant
+ // NOTE(bill): 'any' literals can never be constant
is_constant = false;
- check_assignment(c, o, field_types[index], str_lit("`any` literal"));
+ check_assignment(c, o, field_types[index], str_lit("'any' literal"));
}
} else {
for_array(index, cl->elems) {
AstNode *elem = cl->elems[index];
if (elem->kind == AstNode_FieldValue) {
- error(elem, "Mixture of `field = value` and value elements in a `any` literal is not allowed");
+ error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
continue;
}
check_expr(c, o, elem);
if (index >= field_count) {
- error(o->expr, "Too many values in `any` literal, expected %td", field_count);
+ error(o->expr, "Too many values in 'any' literal, expected %td", field_count);
break;
}
- // NOTE(bill): `any` literals can never be constant
+ // NOTE(bill): 'any' literals can never be constant
is_constant = false;
- check_assignment(c, o, field_types[index], str_lit("`any` literal"));
+ check_assignment(c, o, field_types[index], str_lit("'any' literal"));
}
if (cl->elems.count < field_count) {
- error(cl->close, "Too few values in `any` literal, expected %td, got %td", field_count, cl->elems.count);
+ error(cl->close, "Too few values in 'any' literal, expected %td, got %td", field_count, cl->elems.count);
}
}
}
@@ -5792,7 +5792,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
for_array(i, cl->elems) {
AstNode *elem = cl->elems[i];
if (elem->kind != AstNode_FieldValue) {
- error(elem, "Only `field = value` elements are allowed in a map literal");
+ error(elem, "Only 'field = value' elements are allowed in a map literal");
continue;
}
ast_node(fv, FieldValue, elem);
@@ -5816,7 +5816,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
}
gbString str = type_to_string(type);
- error(node, "Invalid compound literal type `%s`", str);
+ error(node, "Invalid compound literal type '%s'", str);
gb_string_free(str);
return kind;
}
@@ -5861,7 +5861,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (o->mode == Addressing_Constant) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "A type assertion cannot be applied to a constant expression: `%s`", expr_str);
+ error(o->expr, "A type assertion cannot be applied to a constant expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -5870,7 +5870,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (is_type_untyped(o->type)) {
gbString expr_str = expr_to_string(o->expr);
- error(o->expr, "A type assertion cannot be applied to an untyped expression: `%s`", expr_str);
+ error(o->expr, "A type assertion cannot be applied to an untyped expression: '%s'", expr_str);
gb_string_free(expr_str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -5900,9 +5900,9 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
defer (gb_string_free(expr_str));
defer (gb_string_free(dst_type_str));
if (bsrc->Union.variants.count == 0) {
- error(o->expr, "Cannot type assert `%s` to `%s` as this is an empty union", expr_str, dst_type_str);
+ error(o->expr, "Cannot type assert '%s' to '%s' as this is an empty union", expr_str, dst_type_str);
} else {
- error(o->expr, "Cannot type assert `%s` to `%s` as it is not a variant of that union", expr_str, dst_type_str);
+ error(o->expr, "Cannot type assert '%s' to '%s' as it is not a variant of that union", expr_str, dst_type_str);
}
o->mode = Addressing_Invalid;
o->expr = node;
@@ -5922,7 +5922,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
add_type_info_type(c, t);
} else {
gbString str = type_to_string(o->type);
- error(o->expr, "Type assertions can only operate on unions and `any`, got %s", str);
+ error(o->expr, "Type assertions can only operate on unions and 'any', got %s", str);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -6036,9 +6036,9 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
defer (gb_string_free(str));
defer (gb_string_free(type_str));
if (is_const) {
- error(o->expr, "Cannot index a constant `%s`", str);
+ error(o->expr, "Cannot index a constant '%s'", str);
} else {
- error(o->expr, "Cannot index `%s` of type `%s`", str, type_str);
+ error(o->expr, "Cannot index '%s' of type '%s'", str, type_str);
}
o->mode = Addressing_Invalid;
o->expr = node;
@@ -6047,7 +6047,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (ie->index == nullptr) {
gbString str = expr_to_string(o->expr);
- error(o->expr, "Missing index for `%s`", str);
+ error(o->expr, "Missing index for '%s'", str);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -6094,7 +6094,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
max_count = t->Array.count;
if (o->mode != Addressing_Variable) {
gbString str = expr_to_string(node);
- error(node, "Cannot slice array `%s`, value is not addressable", str);
+ error(node, "Cannot slice array '%s', value is not addressable", str);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -6116,7 +6116,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
if (!valid) {
gbString str = expr_to_string(o->expr);
- error(o->expr, "Cannot slice `%s`", str);
+ error(o->expr, "Cannot slice '%s'", str);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;
@@ -6206,7 +6206,7 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
} else {
gbString str = expr_to_string(o->expr);
gbString typ = type_to_string(o->type);
- error(o->expr, "Cannot dereference `%s` of type `%s`", str, typ);
+ error(o->expr, "Cannot dereference '%s' of type '%s'", str, typ);
gb_string_free(typ);
gb_string_free(str);
o->mode = Addressing_Invalid;
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 3c0714b77..c85ee5ea9 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -30,11 +30,11 @@ void check_stmt_list(Checker *c, Array<AstNode *> stmts, u32 flags) {
if (i+1 < max) {
switch (n->kind) {
case AstNode_ReturnStmt:
- error(n, "Statements after this `return` are never executed");
+ error(n, "Statements after this 'return' are never executed");
break;
case AstNode_BranchStmt:
- error(n, "Statements after this `%.*s` are never executed", LIT(n->BranchStmt.token.string));
+ error(n, "Statements after this '%.*s' are never executed", LIT(n->BranchStmt.token.string));
break;
}
}
@@ -93,9 +93,9 @@ bool check_has_break(AstNode *stmt, bool implicit) {
-// NOTE(bill): The last expression has to be a `return` statement
+// NOTE(bill): The last expression has to be a 'return' statement
// TODO(bill): This is a mild hack and should be probably handled properly
-// TODO(bill): Warn/err against code after `return` that it won't be executed
+// TODO(bill): Warn/err against code after 'return' that it won't be executed
bool check_is_terminating(AstNode *node) {
switch (node->kind) {
case_ast_node(rs, ReturnStmt, node);
@@ -186,10 +186,10 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
AstNode *node = unparen_expr(lhs->expr);
- // NOTE(bill): Ignore assignments to `_`
+ // NOTE(bill): Ignore assignments to '_'
if (is_blank_ident(node)) {
add_entity_definition(&c->info, node, nullptr);
- check_assignment(c, rhs, nullptr, str_lit("assignment to `_` identifier"));
+ check_assignment(c, rhs, nullptr, str_lit("assignment to '_' identifier"));
if (rhs->mode == Addressing_Invalid) {
return nullptr;
}
@@ -280,7 +280,7 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
}
gbString lhs_expr = expr_to_string(lhs->expr);
gbString rhs_expr = expr_to_string(rhs->expr);
- error(rhs->expr, "Cannot assign `%s` to bit field `%s`", rhs_expr, lhs_expr);
+ error(rhs->expr, "Cannot assign '%s' to bit field '%s'", rhs_expr, lhs_expr);
gb_string_free(rhs_expr);
gb_string_free(lhs_expr);
return nullptr;
@@ -297,7 +297,7 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
if (tav.mode != Addressing_Variable) {
if (!is_type_pointer(tav.type)) {
gbString str = expr_to_string(lhs->expr);
- error(lhs->expr, "Cannot assign to the value of a map `%s`", str);
+ error(lhs->expr, "Cannot assign to the value of a map '%s'", str);
gb_string_free(str);
return nullptr;
}
@@ -315,7 +315,7 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
check_expr(c, &op_c, se->expr);
if (op_c.mode == Addressing_MapIndex) {
gbString str = expr_to_string(lhs->expr);
- error(lhs->expr, "Cannot assign to struct field `%s` in map", str);
+ error(lhs->expr, "Cannot assign to struct field '%s' in map", str);
gb_string_free(str);
return nullptr;
}
@@ -323,9 +323,9 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
gbString str = expr_to_string(lhs->expr);
if (lhs->mode == Addressing_Immutable) {
- error(lhs->expr, "Cannot assign to an immutable: `%s`", str);
+ error(lhs->expr, "Cannot assign to an immutable: '%s'", str);
} else {
- error(lhs->expr, "Cannot assign to `%s`", str);
+ error(lhs->expr, "Cannot assign to '%s'", str);
}
gb_string_free(str);
@@ -341,21 +341,21 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
return rhs->type;
}
-enum MatchTypeKind {
- MatchType_Invalid,
- MatchType_Union,
- MatchType_Any,
+enum SwitchTypeKind {
+ SwitchType_Invalid,
+ SwitchType_Union,
+ SwitchType_Any,
};
-MatchTypeKind check_valid_type_match_type(Type *type) {
+SwitchTypeKind check_valid_type_switch_type(Type *type) {
type = type_deref(type);
if (is_type_union(type)) {
- return MatchType_Union;
+ return SwitchType_Union;
}
if (is_type_any(type)) {
- return MatchType_Any;
+ return SwitchType_Any;
}
- return MatchType_Invalid;
+ return SwitchType_Invalid;
}
void check_stmt_internal(Checker *c, AstNode *node, u32 flags);
@@ -394,11 +394,11 @@ void check_when_stmt(Checker *c, AstNodeWhenStmt *ws, u32 flags) {
Operand operand = {Addressing_Invalid};
check_expr(c, &operand, ws->cond);
if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
- error(ws->cond, "Non-constant boolean `when` condition");
+ error(ws->cond, "Non-constant boolean 'when' condition");
return;
}
if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
- error(ws->cond, "Invalid body for `when` statement");
+ error(ws->cond, "Invalid body for 'when' statement");
return;
}
if (operand.value.kind == ExactValue_Bool &&
@@ -413,7 +413,7 @@ void check_when_stmt(Checker *c, AstNodeWhenStmt *ws, u32 flags) {
check_when_stmt(c, &ws->else_stmt->WhenStmt, flags);
break;
default:
- error(ws->else_stmt, "Invalid `else` statement in `when` statement");
+ error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -445,7 +445,7 @@ void check_label(Checker *c, AstNode *label) {
for_array(i, c->context.decl->labels) {
BlockLabel bl = c->context.decl->labels[i];
if (bl.name == name) {
- error(label, "Duplicate label with the name `%.*s`", LIT(name));
+ error(label, "Duplicate label with the name '%.*s'", LIT(name));
ok = false;
break;
}
@@ -461,10 +461,10 @@ void check_label(Checker *c, AstNode *label) {
}
}
-// Returns `true` for `continue`, `false` for `return`
+// Returns 'true' for 'continue', 'false' for 'return'
bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bool is_selector, Entity *e) {
if (e == nullptr) {
- error(us->token, "`using` applied to an unknown entity");
+ error(us->token, "'using' applied to an unknown entity");
return true;
}
@@ -481,14 +481,14 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
Entity *found = scope_insert_entity(c->context.scope, f);
if (found != nullptr) {
gbString expr_str = expr_to_string(expr);
- error(us->token, "Namespace collision while `using` `%s` of: %.*s", expr_str, LIT(found->token.string));
+ error(us->token, "Namespace collision while 'using' '%s' of: %.*s", expr_str, LIT(found->token.string));
gb_string_free(expr_str);
return false;
}
f->using_parent = e;
}
} else {
- error(us->token, "`using` can be only applied to enum type entities");
+ error(us->token, "'using' can be only applied to enum type entities");
}
break;
@@ -504,7 +504,7 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
if (found != nullptr) {
gbString expr_str = expr_to_string(expr);
error(us->token,
- "Namespace collision while `using` `%s` of: %.*s\n"
+ "Namespace collision while 'using' '%s' of: %.*s\n"
"\tat %.*s(%td:%td)\n"
"\tat %.*s(%td:%td)",
expr_str, LIT(found->token.string),
@@ -534,14 +534,14 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
Entity *prev = scope_insert_entity(c->context.scope, uvar);
if (prev != nullptr) {
gbString expr_str = expr_to_string(expr);
- error(us->token, "Namespace collision while `using` `%s` of: %.*s", expr_str, LIT(prev->token.string));
+ error(us->token, "Namespace collision while 'using' '%s' of: %.*s", expr_str, LIT(prev->token.string));
gb_string_free(expr_str);
return false;
}
}
}
} else {
- error(us->token, "`using` can only be applied to variables of type struct or raw_union");
+ error(us->token, "'using' can only be applied to variables of type struct or raw_union");
return false;
}
@@ -549,28 +549,28 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
}
case Entity_Constant:
- error(us->token, "`using` cannot be applied to a constant");
+ error(us->token, "'using' cannot be applied to a constant");
break;
case Entity_Procedure:
case Entity_Builtin:
- error(us->token, "`using` cannot be applied to a procedure");
+ error(us->token, "'using' cannot be applied to a procedure");
break;
case Entity_Nil:
- error(us->token, "`using` cannot be applied to `nil`");
+ error(us->token, "'using' cannot be applied to 'nil'");
break;
case Entity_Label:
- error(us->token, "`using` cannot be applied to a label");
+ error(us->token, "'using' cannot be applied to a label");
break;
case Entity_Invalid:
- error(us->token, "`using` cannot be applied to an invalid entity");
+ error(us->token, "'using' cannot be applied to an invalid entity");
break;
default:
- GB_PANIC("TODO(bill): `using` other expressions?");
+ GB_PANIC("TODO(bill): 'using' other expressions?");
}
return true;
@@ -589,7 +589,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
switch (operand.mode) {
case Addressing_Type: {
gbString str = type_to_string(operand.type);
- error(node, "`%s` is not an expression", str);
+ error(node, "'%s' is not an expression", str);
gb_string_free(str);
break;
@@ -606,14 +606,14 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (is_type_proc(t)) {
if (t->Proc.require_results) {
gbString expr_str = expr_to_string(ce->proc);
- error(node, "`%s` requires that its results must be handled", expr_str);
+ error(node, "'%s' requires that its results must be handled", expr_str);
gb_string_free(expr_str);
}
}
return;
}
gbString expr_str = expr_to_string(operand.expr);
- error(node, "Expression is not used: `%s`", expr_str);
+ error(node, "Expression is not used: '%s'", expr_str);
gb_string_free(expr_str);
break;
@@ -717,7 +717,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
check_assignment_variable(c, &lhs_operands[i], &rhs_operands[i]);
}
if (lhs_count != rhs_count) {
- error(as->lhs[0], "Assignment count mismatch `%td` = `%td`", lhs_count, rhs_count);
+ error(as->lhs[0], "Assignment count mismatch '%td' = '%td'", lhs_count, rhs_count);
}
break;
}
@@ -726,11 +726,11 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
// a += 1; // Single-sided
Token op = as->op;
if (as->lhs.count != 1 || as->rhs.count != 1) {
- error(op, "Assignment operation `%.*s` requires single-valued expressions", LIT(op.string));
+ error(op, "Assignment operation '%.*s' requires single-valued expressions", LIT(op.string));
return;
}
if (!gb_is_between(op.kind, Token__AssignOpBegin+1, Token__AssignOpEnd-1)) {
- error(op, "Unknown Assignment operation `%.*s`", LIT(op.string));
+ error(op, "Unknown Assignment operation '%.*s'", LIT(op.string));
return;
}
Operand lhs = {Addressing_Invalid};
@@ -772,7 +772,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Operand operand = {Addressing_Invalid};
check_expr(c, &operand, is->cond);
if (operand.mode != Addressing_Invalid && !is_type_boolean(operand.type)) {
- error(is->cond, "Non-boolean condition in `if` statement");
+ error(is->cond, "Non-boolean condition in 'if' statement");
}
check_stmt(c, is->body, mod_flags);
@@ -784,7 +784,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
check_stmt(c, is->else_stmt, mod_flags);
break;
default:
- error(is->else_stmt, "Invalid `else` statement in `if` statement");
+ error(is->else_stmt, "Invalid 'else' statement in 'if' statement");
break;
}
}
@@ -800,7 +800,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
GB_ASSERT(c->proc_stack.count > 0);
if (c->context.in_defer) {
- error(rs->token, "You cannot `return` within a defer statement");
+ error(rs->token, "You cannot 'return' within a defer statement");
break;
}
@@ -817,7 +817,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
mix = arg->kind == AstNode_FieldValue;
}
if (mix) {
- error(arg, "Mixture of `field = value` and value elements in a procedure all is not allowed");
+ error(arg, "Mixture of 'field = value' and value elements in a procedure all is not allowed");
fail = true;
}
}
@@ -876,18 +876,18 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
ast_node(fv, FieldValue, arg);
if (fv->field->kind != AstNode_Ident) {
gbString expr_str = expr_to_string(fv->field);
- error(arg, "Invalid parameter name `%s` in return statement", expr_str);
+ error(arg, "Invalid parameter name '%s' in return statement", expr_str);
gb_string_free(expr_str);
continue;
}
String name = fv->field->Ident.token.string;
isize index = lookup_procedure_result(pt, name);
if (index < 0) {
- error(arg, "No result named `%.*s` for this procedure type", LIT(name));
+ error(arg, "No result named '%.*s' for this procedure type", LIT(name));
continue;
}
if (visited[index]) {
- error(arg, "Duplicate result `%.*s` in return statement", LIT(name));
+ error(arg, "Duplicate result '%.*s' in return statement", LIT(name));
continue;
}
@@ -913,7 +913,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
gbString str = type_to_string(e->type);
- error(node, "Return value `%.*s` of type `%s` is missing in return statement",
+ error(node, "Return value '%.*s' of type '%s' is missing in return statement",
LIT(e->token.string), str);
gb_string_free(str);
}
@@ -956,7 +956,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Operand o = {Addressing_Invalid};
check_expr(c, &o, fs->cond);
if (o.mode != Addressing_Invalid && !is_type_boolean(o.type)) {
- error(fs->cond, "Non-boolean condition in `for` statement");
+ error(fs->cond, "Non-boolean condition in 'for' statement");
}
}
if (fs->post != nullptr) {
@@ -964,7 +964,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (fs->post->kind != AstNode_AssignStmt &&
fs->post->kind != AstNode_IncDecStmt) {
- error(fs->post, "`for` statement post statement must be a simple statement");
+ error(fs->post, "'for' statement post statement must be a simple statement");
}
}
check_stmt(c, fs->body, new_flags);
@@ -1024,7 +1024,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
gbString xt = type_to_string(x.type);
gbString yt = type_to_string(y.type);
gbString expr_str = expr_to_string(x.expr);
- error(ie->op, "Mismatched types in interval expression `%s` : `%s` vs `%s`", expr_str, xt, yt);
+ error(ie->op, "Mismatched types in interval expression '%s' : '%s' vs '%s'", expr_str, xt, yt);
gb_string_free(expr_str);
gb_string_free(yt);
gb_string_free(xt);
@@ -1078,7 +1078,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (operand.mode == Addressing_Type) {
if (!is_type_enum(operand.type)) {
gbString t = type_to_string(operand.type);
- error(operand.expr, "Cannot iterate over the type `%s`", t);
+ error(operand.expr, "Cannot iterate over the type '%s'", t);
gb_string_free(t);
goto skip_expr;
} else {
@@ -1127,7 +1127,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (val == nullptr) {
gbString s = expr_to_string(operand.expr);
gbString t = type_to_string(operand.type);
- error(operand.expr, "Cannot iterate over `%s` of type `%s`", s, t);
+ error(operand.expr, "Cannot iterate over '%s' of type '%s'", s, t);
gb_string_free(t);
gb_string_free(s);
}
@@ -1160,7 +1160,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
} else {
TokenPos pos = found->token.pos;
error(token,
- "Redeclaration of `%.*s` in this scope\n"
+ "Redeclaration of '%.*s' in this scope\n"
"\tat %.*s(%td:%td)",
LIT(str), LIT(pos.file), pos.line, pos.column);
entity = found;
@@ -1202,7 +1202,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
if (ss->tag != nullptr) {
check_expr(c, &x, ss->tag);
- check_assignment(c, &x, nullptr, str_lit("match expression"));
+ check_assignment(c, &x, nullptr, str_lit("switch expression"));
} else {
x.mode = Addressing_Constant;
x.type = t_bool;
@@ -1215,7 +1215,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
if (is_type_vector(x.type)) {
gbString str = type_to_string(x.type);
- error(x.expr, "Invalid match expression type: %s", str);
+ error(x.expr, "Invalid switch expression type: %s", str);
gb_string_free(str);
break;
}
@@ -1240,7 +1240,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (first_default != nullptr) {
TokenPos pos = ast_node_token(first_default).pos;
error(stmt,
- "multiple `default` clauses\n"
+ "multiple default clauses\n"
"\tfirst at %.*s(%td:%td)",
LIT(pos.file), pos.line, pos.column);
} else {
@@ -1281,7 +1281,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (!is_type_ordered(x.type)) {
gbString str = type_to_string(x.type);
- error(x.expr, "Unordered type `%s`, is invalid for an interval expression", str);
+ error(x.expr, "Unordered type '%s', is invalid for an interval expression", str);
gb_string_free(str);
continue;
}
@@ -1359,7 +1359,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
TokenPos pos = tap.token.pos;
gbString expr_str = expr_to_string(y.expr);
error(y.expr,
- "Duplicate case `%s`\n"
+ "Duplicate case '%s'\n"
"\tprevious case at %.*s(%td:%td)",
expr_str,
LIT(pos.file), pos.line, pos.column);
@@ -1401,32 +1401,32 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
check_open_scope(c, node);
check_label(c, ss->label); // TODO(bill): What should the label's "scope" be?
- MatchTypeKind match_type_kind = MatchType_Invalid;
+ SwitchTypeKind switch_type_kind = SwitchType_Invalid;
if (ss->tag->kind != AstNode_AssignStmt) {
- error(ss->tag, "Expected an `in` assignment for this type match statement");
+ error(ss->tag, "Expected an 'in' assignment for this type switch statement");
break;
}
ast_node(as, AssignStmt, ss->tag);
Token as_token = ast_node_token(ss->tag);
if (as->lhs.count != 1) {
- syntax_error(as_token, "Expected 1 name before `in`");
+ syntax_error(as_token, "Expected 1 name before 'in'");
break;
}
if (as->rhs.count != 1) {
- syntax_error(as_token, "Expected 1 expression after `in`");
+ syntax_error(as_token, "Expected 1 expression after 'in'");
break;
}
AstNode *lhs = as->lhs[0];
AstNode *rhs = as->rhs[0];
check_expr(c, &x, rhs);
- check_assignment(c, &x, nullptr, str_lit("type match expression"));
- match_type_kind = check_valid_type_match_type(x.type);
- if (check_valid_type_match_type(x.type) == MatchType_Invalid) {
+ check_assignment(c, &x, nullptr, str_lit("type switch expression"));
+ switch_type_kind = check_valid_type_switch_type(x.type);
+ if (check_valid_type_switch_type(x.type) == SwitchType_Invalid) {
gbString str = type_to_string(x.type);
- error(x.expr, "Invalid type for this type match expression, got `%s`", str);
+ error(x.expr, "Invalid type for this type switch expression, got '%s'", str);
gb_string_free(str);
break;
}
@@ -1452,7 +1452,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (first_default != nullptr) {
TokenPos pos = ast_node_token(first_default).pos;
error(stmt,
- "Multiple `default` clauses\n"
+ "Multiple 'default' clauses\n"
"\tfirst at %.*s(%td:%td)", LIT(pos.file), pos.line, pos.column);
} else {
first_default = default_stmt;
@@ -1462,7 +1462,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (lhs->kind != AstNode_Ident) {
- error(rhs, "Expected an identifier, got `%.*s`", LIT(ast_node_strings[rhs->kind]));
+ error(rhs, "Expected an identifier, got '%.*s'", LIT(ast_node_strings[rhs->kind]));
break;
}
@@ -1488,7 +1488,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Operand y = {};
check_expr_or_type(c, &y, type_expr);
- if (match_type_kind == MatchType_Union) {
+ if (switch_type_kind == SwitchType_Union) {
GB_ASSERT(is_type_union(bt));
bool tag_type_found = false;
for_array(i, bt->Union.variants) {
@@ -1500,15 +1500,15 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
if (!tag_type_found) {
gbString type_str = type_to_string(y.type);
- error(y.expr, "Unknown tag type, got `%s`", type_str);
+ error(y.expr, "Unknown tag type, got '%s'", type_str);
gb_string_free(type_str);
continue;
}
case_type = y.type;
- } else if (match_type_kind == MatchType_Any) {
+ } else if (switch_type_kind == SwitchType_Any) {
case_type = y.type;
} else {
- GB_PANIC("Unknown type to type match statement");
+ GB_PANIC("Unknown type to type switch statement");
}
HashKey key = hash_type(y.type);
@@ -1517,7 +1517,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
TokenPos pos = cc->token.pos;
gbString expr_str = expr_to_string(y.expr);
error(y.expr,
- "Duplicate type case `%s`\n"
+ "Duplicate type case '%s'\n"
"\tprevious type case at %.*s(%td:%td)",
expr_str,
LIT(pos.file), pos.line, pos.column);
@@ -1577,21 +1577,21 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
switch (token.kind) {
case Token_break:
if ((flags & Stmt_BreakAllowed) == 0) {
- error(token, "`break` only allowed in loops or `match` statements");
+ error(token, "'break' only allowed in loops or 'switch' statements");
}
break;
case Token_continue:
if ((flags & Stmt_ContinueAllowed) == 0) {
- error(token, "`continue` only allowed in loops");
+ error(token, "'continue' only allowed in loops");
}
break;
case Token_fallthrough:
if ((flags & Stmt_FallthroughAllowed) == 0) {
- error(token, "`fallthrough` statement in illegal position");
+ error(token, "'fallthrough' statement in illegal position");
}
break;
default:
- error(token, "Invalid AST: Branch Statement `%.*s`", LIT(token.string));
+ error(token, "Invalid AST: Branch Statement '%.*s'", LIT(token.string));
break;
}
@@ -1610,7 +1610,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
}
add_entity_use(c, ident, e);
if (e->kind != Entity_Label) {
- error(ident, "`%.*s` is not a label", LIT(name));
+ error(ident, "'%.*s' is not a label", LIT(name));
return;
}
}
@@ -1619,7 +1619,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
case_ast_node(us, UsingStmt, node);
if (us->list.count == 0) {
- error(us->token, "Empty `using` list");
+ error(us->token, "Empty 'using' list");
return;
}
for_array(i, us->list) {
@@ -1637,10 +1637,10 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
is_selector = true;
break;
case AstNode_Implicit:
- error(us->token, "`using` applied to an implicit value");
+ error(us->token, "'using' applied to an implicit value");
continue;
default:
- error(us->token, "`using` can only be applied to an entity, got %.*s", LIT(ast_node_strings[expr->kind]));
+ error(us->token, "'using' can only be applied to an entity, got %.*s", LIT(ast_node_strings[expr->kind]));
continue;
}
@@ -1697,7 +1697,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Token token = name->Ident.token;
String str = token.string;
Entity *found = nullptr;
- // NOTE(bill): Ignore assignments to `_`
+ // NOTE(bill): Ignore assignments to '_'
if (!is_blank_ident(str)) {
found = current_scope_lookup_entity(c->context.scope, str);
}
@@ -1714,7 +1714,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
} else {
TokenPos pos = found->token.pos;
error(token,
- "Redeclaration of `%.*s` in this scope\n"
+ "Redeclaration of '%.*s' in this scope\n"
"\tat %.*s(%td:%td)",
LIT(str), LIT(pos.file), pos.line, pos.column);
entity = found;
@@ -1734,12 +1734,12 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
init_type = t_invalid;
} else if (is_type_polymorphic(base_type(init_type))) {
gbString str = type_to_string(init_type);
- error(vd->type, "Invalid use of a polymorphic type `%s` in variable declaration", str);
+ error(vd->type, "Invalid use of a polymorphic type '%s' in variable declaration", str);
gb_string_free(str);
init_type = t_invalid;
} else if (is_type_empty_union(init_type)) {
gbString str = type_to_string(init_type);
- error(vd->type, "An empty union `%s` cannot be instantiated in variable declaration", str);
+ error(vd->type, "An empty union '%s' cannot be instantiated in variable declaration", str);
gb_string_free(str);
init_type = t_invalid;
}
@@ -1800,7 +1800,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Type *other_type = base_type(f->type);
if (!are_types_identical(this_type, other_type)) {
error(e->token,
- "Foreign entity `%.*s` previously declared elsewhere with a different type\n"
+ "Foreign entity '%.*s' previously declared elsewhere with a different type\n"
"\tat %.*s(%td:%td)",
LIT(name), LIT(pos.file), pos.line, pos.column);
}
@@ -1814,8 +1814,8 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
if (vd->is_using != 0) {
Token token = ast_node_token(node);
if (vd->type != nullptr && entity_count > 1) {
- error(token, "`using` can only be applied to one variable of the same type");
- // TODO(bill): Should a `continue` happen here?
+ error(token, "'using' can only be applied to one variable of the same type");
+ // TODO(bill): Should a 'continue' happen here?
}
for (isize entity_index = 0; entity_index < entity_count; entity_index++) {
@@ -1831,7 +1831,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
Type *t = base_type(type_deref(e->type));
if (is_blank_ident(name)) {
- error(token, "`using` cannot be applied variable declared as `_`");
+ error(token, "'using' cannot be applied variable declared as '_'");
} else if (is_type_struct(t) || is_type_raw_union(t)) {
Scope *scope = scope_of_node(&c->info, t->Struct.node);
for_array(i, scope->elements.entries) {
@@ -1841,14 +1841,14 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
uvar->Variable.is_immutable = is_immutable;
Entity *prev = scope_insert_entity(c->context.scope, uvar);
if (prev != nullptr) {
- error(token, "Namespace collision while `using` `%.*s` of: %.*s", LIT(name), LIT(prev->token.string));
+ error(token, "Namespace collision while 'using' '%.*s' of: %.*s", LIT(name), LIT(prev->token.string));
return;
}
}
}
} else {
// NOTE(bill): skip the rest to remove extra errors
- error(token, "`using` can only be applied to variables of type struct or raw_union");
+ error(token, "'using' can only be applied to variables of type struct or raw_union");
return;
}
}
diff --git a/src/check_type.cpp b/src/check_type.cpp
index fe9c9c4ae..65a609e36 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -18,9 +18,9 @@ void populate_using_entity_map(Checker *c, AstNode *node, Type *t, Map<Entity *>
Entity *e = *found;
// TODO(bill): Better type error
if (str != nullptr) {
- error(e->token, "`%.*s` is already declared in `%s`", LIT(name), str);
+ error(e->token, "'%.*s' is already declared in '%s'", LIT(name), str);
} else {
- error(e->token, "`%.*s` is already declared`", LIT(name));
+ error(e->token, "'%.*s' is already declared", LIT(name));
}
} else {
map_set(entity_map, key, f);
@@ -42,11 +42,11 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
Operand operand = {Addressing_Invalid};
check_expr(c, &operand, ws->cond);
if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
- error(ws->cond, "Non-constant boolean `when` condition");
+ error(ws->cond, "Non-constant boolean 'when' condition");
return;
}
if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
- error(ws->cond, "Invalid body for `when` statement");
+ error(ws->cond, "Invalid body for 'when' statement");
return;
}
if (operand.value.kind == ExactValue_Bool &&
@@ -67,7 +67,7 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
check_struct_field_decl(c, ws->else_stmt, fields, entity_map, struct_node, context, allow_default_values);
break;
default:
- error(ws->else_stmt, "Invalid `else` statement in `when` statement");
+ error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -85,7 +85,7 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
bool is_using = vd->is_using;
if (is_using && vd->names.count > 1) {
- error(vd->names[0], "Cannot apply `using` to more than one of the same type");
+ error(vd->names[0], "Cannot apply 'using' to more than one of the same type");
is_using = false;
}
@@ -175,7 +175,7 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
error(b.expr, "Default field value must be a constant");
} else if (is_type_any(e->type) || is_type_union(e->type)) {
gbString str = type_to_string(e->type);
- error(b.expr, "A struct field of type `%s` cannot have a default value", str);
+ error(b.expr, "A struct field of type '%s' cannot have a default value", str);
gb_string_free(str);
} else {
e->Variable.default_value = b.value;
@@ -196,7 +196,7 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
Entity *e = *found;
// NOTE(bill): Scope checking already checks the declaration but in many cases, this can happen so why not?
// This may be a little janky but it's not really that much of a problem
- error(name_token, "`%.*s` is already declared in this type", LIT(name_token.string));
+ error(name_token, "'%.*s' is already declared in this type", LIT(name_token.string));
error(e->token, "\tpreviously declared");
} else {
map_set(entity_map, key, e);
@@ -235,11 +235,11 @@ void check_struct_field_decl(Checker *c, AstNode *decl, Array<Entity *> *fields,
using_index_expr = (*fields)[fields->count-1];
} else {
(*fields)[fields->count-1]->flags &= ~EntityFlag_Using;
- error(name_token, "Previous `using` for an index expression `%.*s`", LIT(name_token.string));
+ error(name_token, "Previous 'using' for an index expression '%.*s'", LIT(name_token.string));
}
} else {
gbString type_str = type_to_string(first_type);
- error(name_token, "`using` cannot be applied to the field `%.*s` of type `%s`", LIT(name_token.string), type_str);
+ error(name_token, "'using' cannot be applied to the field '%.*s' of type '%s'", LIT(name_token.string), type_str);
gb_string_free(type_str);
return;
}
@@ -382,7 +382,7 @@ Array<Entity *> check_struct_fields(Checker *c, AstNode *node, Array<AstNode *>
}
if (is_type_empty_union(type)) {
gbString str = type_to_string(type);
- error(params[i], "Invalid use of an empty union `%s`", str);
+ error(params[i], "Invalid use of an empty union '%s'", str);
gb_string_free(str);
type = t_invalid;
}
@@ -436,11 +436,11 @@ Array<Entity *> check_struct_fields(Checker *c, AstNode *node, Array<AstNode *>
using_index_expr = fields[fields.count-1];
} else {
fields[fields.count-1]->flags &= ~EntityFlag_Using;
- error(name_token, "Previous `using` for an index expression `%.*s`", LIT(name_token.string));
+ error(name_token, "Previous 'using' for an index expression '%.*s'", LIT(name_token.string));
}
} else {
gbString type_str = type_to_string(first_type);
- error(name_token, "`using` cannot be applied to the field `%.*s` of type `%s`", LIT(name_token.string), type_str);
+ error(name_token, "'using' cannot be applied to the field '%.*s' of type '%s'", LIT(name_token.string), type_str);
gb_string_free(type_str);
continue;
}
@@ -465,7 +465,7 @@ gb_global gbAllocator __checker_allocator = {};
GB_COMPARE_PROC(cmp_reorder_struct_fields) {
// Rule:
- // `using` over non-`using`
+ // 'using' over non-'using'
// Biggest to smallest alignment
// if same alignment: biggest to smallest size
// if same size: order by source order
@@ -847,7 +847,7 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node, Array<Opera
if (st->align != nullptr) {
if (st->is_packed) {
- syntax_error(st->align, "`#align` cannot be applied with `#packed`");
+ syntax_error(st->align, "'#align' cannot be applied with '#packed'");
return;
}
i64 custom_align = 1;
@@ -881,14 +881,14 @@ void check_union_type(Checker *c, Type *union_type, AstNode *node) {
if (is_type_untyped(t) || is_type_empty_union(t)) {
ok = false;
gbString str = type_to_string(t);
- error(node, "Invalid variant type in union `%s`", str);
+ error(node, "Invalid variant type in union '%s'", str);
gb_string_free(str);
} else {
for_array(j, variants) {
if (are_types_identical(t, variants[j])) {
ok = false;
gbString str = type_to_string(t);
- error(node, "Duplicate variant type `%s`", str);
+ error(node, "Duplicate variant type '%s'", str);
gb_string_free(str);
break;
}
@@ -935,7 +935,7 @@ void check_enum_type(Checker *c, Type *enum_type, Type *named_type, AstNode *nod
return;
}
- // NOTE(bill): Must be up here for the `check_init_constant` system
+ // NOTE(bill): Must be up here for the 'check_init_constant' system
enum_type->Enum.base_type = base_type;
Map<Entity *> entity_map = {}; // Key: String
@@ -997,19 +997,19 @@ void check_enum_type(Checker *c, Type *enum_type, Type *named_type, AstNode *nod
if (is_blank_ident(name)) {
continue;
} else if (name == "count") {
- error(field, "`count` is a reserved identifier for enumerations");
+ error(field, "'count' is a reserved identifier for enumerations");
continue;
} else if (name == "min_value") {
- error(field, "`min_value` is a reserved identifier for enumerations");
+ error(field, "'min_value' is a reserved identifier for enumerations");
continue;
} else if (name == "max_value") {
- error(field, "`max_value` is a reserved identifier for enumerations");
+ error(field, "'max_value' is a reserved identifier for enumerations");
continue;
} else if (name == "names") {
- error(field, "`names` is a reserved identifier for enumerations");
+ error(field, "'names' is a reserved identifier for enumerations");
continue;
}/* else if (name == "base_type") {
- error(field, "`base_type` is a reserved identifier for enumerations");
+ error(field, "'base_type' is a reserved identifier for enumerations");
continue;
} */
@@ -1026,7 +1026,7 @@ void check_enum_type(Checker *c, Type *enum_type, Type *named_type, AstNode *nod
HashKey key = hash_string(name);
if (map_get(&entity_map, key) != nullptr) {
- error(ident, "`%.*s` is already declared in this enumeration", LIT(name));
+ error(ident, "'%.*s' is already declared in this enumeration", LIT(name));
} else {
map_set(&entity_map, key, e);
add_entity(c, c->context.scope, nullptr, e);
@@ -1104,7 +1104,7 @@ void check_bit_field_type(Checker *c, Type *bit_field_type, AstNode *node) {
HashKey key = hash_string(name);
if (!is_blank_ident(name) &&
map_get(&entity_map, key) != nullptr) {
- error(ident, "`%.*s` is already declared in this bit field", LIT(name));
+ error(ident, "'%.*s' is already declared in this bit field", LIT(name));
} else {
map_set(&entity_map, key, e);
add_entity(c, c->context.scope, nullptr, e);
@@ -1204,7 +1204,7 @@ Type *determine_type_from_polymorphic(Checker *c, Type *poly_type, Operand opera
gbString ots = type_to_string(operand.type);
defer (gb_string_free(pts));
defer (gb_string_free(ots));
- error(operand.expr, "Cannot determine polymorphic type from parameter: `%s` to `%s`", ots, pts);
+ error(operand.expr, "Cannot determine polymorphic type from parameter: '%s' to '%s'", ots, pts);
}
return t_invalid;
}
@@ -1432,7 +1432,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
}
if (is_type_empty_union(type)) {
gbString str = type_to_string(type);
- error(param, "Invalid use of an empty union `%s`", str);
+ error(param, "Invalid use of an empty union '%s'", str);
gb_string_free(str);
type = t_invalid;
}
@@ -1441,7 +1441,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
if (p->flags&FieldFlag_c_vararg) {
if (p->type == nullptr ||
p->type->kind != AstNode_Ellipsis) {
- error(param, "`#c_vararg` can only be applied to variadic type fields");
+ error(param, "'#c_vararg' can only be applied to variadic type fields");
p->flags &= ~FieldFlag_c_vararg; // Remove the flag
} else {
is_c_vararg = true;
@@ -1450,10 +1450,10 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
if (is_constant_value) {
if (is_type_param) {
- error(param, "`$` is not needed for a `type` parameter");
+ error(param, "'$' is not needed for a 'type' parameter");
}
if (p->flags&FieldFlag_no_alias) {
- error(param, "`#no_alias` can only be applied to variable fields of pointer type");
+ error(param, "'#no_alias' can only be applied to variable fields of pointer type");
p->flags &= ~FieldFlag_no_alias; // Remove the flag
}
@@ -1480,7 +1480,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
}
if (is_type_polymorphic(type)) {
gbString str = type_to_string(type);
- error(o.expr, "Cannot pass polymorphic type as a parameter, got `%s`", str);
+ error(o.expr, "Cannot pass polymorphic type as a parameter, got '%s'", str);
gb_string_free(str);
success = false;
type = t_invalid;
@@ -1491,7 +1491,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
if (!c->context.no_polymorphic_errors) {
gbString t = type_to_string(type);
gbString s = type_to_string(specialization);
- error(o.expr, "Cannot convert type `%s` to the specialization `%s`", t, s);
+ error(o.expr, "Cannot convert type '%s' to the specialization '%s'", t, s);
gb_string_free(s);
gb_string_free(t);
}
@@ -1517,7 +1517,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
if (p->flags&FieldFlag_no_alias) {
if (!is_type_pointer(type)) {
- error(name, "`#no_alias` can only be applied to fields of pointer type");
+ error(name, "'#no_alias' can only be applied to fields of pointer type");
p->flags &= ~FieldFlag_no_alias; // Remove the flag
}
}
@@ -1713,7 +1713,7 @@ Type *check_get_results(Checker *c, Scope *scope, AstNode *_results) {
continue;
}
if (x == y) {
- error(variables[j]->token, "Duplicate return value name `%.*s`", LIT(y));
+ error(variables[j]->token, "Duplicate return value name '%.*s'", LIT(y));
}
}
}
@@ -1912,7 +1912,7 @@ bool abi_compat_return_by_value(gbAllocator a, ProcCallingConvention cc, Type *a
return false;
}
-// NOTE(bill): `operands` is for generating non generic procedure type
+// NOTE(bill): 'operands' is for generating non generic procedure type
bool check_procedure_type(Checker *c, Type *type, AstNode *proc_type_node, Array<Operand> *operands) {
ast_node(pt, ProcType, proc_type_node);
@@ -2147,7 +2147,7 @@ void check_map_type(Checker *c, Type *type, AstNode *node) {
error(node, "A boolean cannot be used as a key for a map, use an array instead for this case");
} else {
gbString str = type_to_string(key);
- error(node, "Invalid type of a key for a map, got `%s`", str);
+ error(node, "Invalid type of a key for a map, got '%s'", str);
gb_string_free(str);
}
}
@@ -2159,7 +2159,7 @@ void check_map_type(Checker *c, Type *type, AstNode *node) {
init_preload(c);
generate_map_internal_types(c->allocator, type);
- // error(node, "`map` types are not yet implemented");
+ // error(node, "'map' types are not yet implemented");
}
bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type) {
@@ -2185,13 +2185,13 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
case Addressing_NoValue:
err_str = expr_to_string(e);
- error(e, "`%s` used as a type", err_str);
+ error(e, "'%s' used as a type", err_str);
gb_string_free(err_str);
break;
default:
err_str = expr_to_string(e);
- error(e, "`%s` used as a type when not a type", err_str);
+ error(e, "'%s' used as a type when not a type", err_str);
gb_string_free(err_str);
break;
}
@@ -2202,7 +2202,7 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
case_end;
case_ast_node(at, AliasType, e);
- error(e, "Invalid use of `#alias`");
+ error(e, "Invalid use of '#alias'");
// NOTE(bill): Treat it as a HelperType to remove errors
return check_type_internal(c, at->type, type, named_type);
case_end;
@@ -2241,7 +2241,7 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
add_entity(c, ps, ident, e);
add_entity(c, s, ident, e);
} else {
- error(ident, "Invalid use of a polymorphic parameter `$%.*s`", LIT(token.string));
+ error(ident, "Invalid use of a polymorphic parameter '$%.*s'", LIT(token.string));
*type = t_invalid;
return false;
}
@@ -2263,12 +2263,12 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
return true;
case Addressing_NoValue:
err_str = expr_to_string(e);
- error(e, "`%s` used as a type", err_str);
+ error(e, "'%s' used as a type", err_str);
gb_string_free(err_str);
break;
default:
err_str = expr_to_string(e);
- error(e, "`%s` is not a type", err_str);
+ error(e, "'%s' is not a type", err_str);
gb_string_free(err_str);
break;
}
@@ -2341,7 +2341,7 @@ bool check_type_internal(Checker *c, AstNode *e, Type **type, Type *named_type)
Type *be = base_type(elem);
if (is_type_vector(be) || (!is_type_boolean(be) && !is_type_numeric(be) && be->kind != Type_Generic)) {
gbString err_str = type_to_string(elem);
- error(vt->elem, "Vector element type must be numerical or a boolean, got `%s`", err_str);
+ error(vt->elem, "Vector element type must be numerical or a boolean, got '%s'", err_str);
gb_string_free(err_str);
}
*type = make_type_vector(c->allocator, elem, count, generic_type);
@@ -2434,7 +2434,7 @@ Type *check_type(Checker *c, AstNode *e, Type *named_type) {
if (!ok) {
gbString err_str = expr_to_string(e);
- error(e, "`%s` is not a type", err_str);
+ error(e, "'%s' is not a type", err_str);
gb_string_free(err_str);
type = t_invalid;
}
@@ -2447,7 +2447,7 @@ Type *check_type(Checker *c, AstNode *e, Type *named_type) {
type->Named.base == nullptr) {
// IMPORTANT TODO(bill): Is this a serious error?!
#if 0
- error(e, "Invalid type definition of `%.*s`", LIT(type->Named.name));
+ error(e, "Invalid type definition of '%.*s'", LIT(type->Named.name));
#endif
type->Named.base = t_invalid;
}
@@ -2455,7 +2455,7 @@ Type *check_type(Checker *c, AstNode *e, Type *named_type) {
#if 0
if (!c->context.allow_polymorphic_types && is_type_polymorphic(type)) {
gbString str = type_to_string(type);
- error(e, "Invalid use of a polymorphic type `%s`", str);
+ error(e, "Invalid use of a polymorphic type '%s'", str);
gb_string_free(str);
type = t_invalid;
}
diff --git a/src/checker.cpp b/src/checker.cpp
index 61c2a4015..77a04d72e 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -230,7 +230,7 @@ struct Scope {
Array<Scope *> shared;
Array<AstNode *> delayed_file_decls;
PtrSet<Scope *> imported;
- PtrSet<Scope *> exported; // NOTE(bhall): Contains `using import` too
+ PtrSet<Scope *> exported; // NOTE(bhall): Contains 'using import' too
bool is_proc;
bool is_global;
bool is_file;
@@ -617,7 +617,7 @@ void destroy_scope(Scope *scope) {
if (e->kind == Entity_Variable) {
if (!(e->flags & EntityFlag_Used)) {
#if 0
- warning(e->token, "Unused variable `%.*s`", LIT(e->token.string));
+ warning(e->token, "Unused variable '%.*s'", LIT(e->token.string));
#endif
}
}
@@ -833,7 +833,7 @@ void add_declaration_dependency(Checker *c, Entity *e) {
Entity *add_global_entity(Entity *entity) {
String name = entity->token.string;
if (gb_memchr(name.text, ' ', name.len)) {
- return entity; // NOTE(bill): `untyped thing`
+ return entity; // NOTE(bill): 'untyped thing'
}
if (scope_insert_entity(universal_scope, entity)) {
compiler_error("double declaration");
@@ -1123,7 +1123,7 @@ isize type_info_index(CheckerInfo *info, Type *type, bool error_on_failure) {
}
if (error_on_failure && entry_index < 0) {
- compiler_error("TypeInfo for `%s` could not be found", type_to_string(type));
+ compiler_error("TypeInfo for '%s' could not be found", type_to_string(type));
}
return entry_index;
}
@@ -1189,7 +1189,7 @@ bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
return false;
}
error(entity->token,
- "Redeclaration of `%.*s` in this scope through `using`\n"
+ "Redeclaration of '%.*s' in this scope through 'using'\n"
"\tat %.*s(%td:%td)",
LIT(name),
LIT(up->token.pos.file), up->token.pos.line, up->token.pos.column);
@@ -1200,7 +1200,7 @@ bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
return false;
}
error(entity->token,
- "Redeclaration of `%.*s` in this scope\n"
+ "Redeclaration of '%.*s' in this scope\n"
"\tat %.*s(%td:%td)",
LIT(name),
LIT(pos.file), pos.line, pos.column);
@@ -1565,26 +1565,26 @@ Array<EntityGraphNode *> generate_entity_dependency_graph(CheckerInfo *info) {
EntityGraphNode *n = entry->value;
if (e->kind == Entity_Procedure) {
- // Connect each pred `p` of `n` with each succ `s` and from
+ // Connect each pred 'p' of 'n' with each succ 's' and from
// the procedure node
for_array(j, n->pred.entries) {
EntityGraphNode *p = cast(EntityGraphNode *)n->pred.entries[j].ptr;
// Ignore self-cycles
if (p != n) {
- // Each succ `s` of `n` becomes a succ of `p`, and
- // each pred `p` of `n` becomes a pred of `s`
+ // Each succ 's' of 'n' becomes a succ of 'p', and
+ // each pred 'p' of 'n' becomes a pred of 's'
for_array(k, n->succ.entries) {
EntityGraphNode *s = n->succ.entries[k].ptr;
// Ignore self-cycles
if (s != n) {
entity_graph_node_set_add(&p->succ, s);
entity_graph_node_set_add(&s->pred, p);
- // Remove edge to `n`
+ // Remove edge to 'n'
entity_graph_node_set_remove(&s->pred, n);
}
}
- // Remove edge to `n`
+ // Remove edge to 'n'
entity_graph_node_set_remove(&p->succ, n);
}
}
@@ -1609,8 +1609,8 @@ Array<EntityGraphNode *> generate_entity_dependency_graph(CheckerInfo *info) {
Entity *find_core_entity(Checker *c, String name) {
Entity *e = current_scope_lookup_entity(c->global_scope, name);
if (e == nullptr) {
- compiler_error("Could not find type declaration for `%.*s`\n"
- "Is `_preload.odin` missing from the `core` directory relative to odin.exe?", LIT(name));
+ compiler_error("Could not find type declaration for '%.*s'\n"
+ "Is '_preload.odin' missing from the 'core' directory relative to odin.exe?", LIT(name));
// NOTE(bill): This will exit the program as it's cannot continue without it!
}
return e;
@@ -1619,8 +1619,8 @@ Entity *find_core_entity(Checker *c, String name) {
Type *find_core_type(Checker *c, String name) {
Entity *e = current_scope_lookup_entity(c->global_scope, name);
if (e == nullptr) {
- compiler_error("Could not find type declaration for `%.*s`\n"
- "Is `_preload.odin` missing from the `core` directory relative to odin.exe?", LIT(name));
+ compiler_error("Could not find type declaration for '%.*s'\n"
+ "Is '_preload.odin' missing from the 'core' directory relative to odin.exe?", LIT(name));
// NOTE(bill): This will exit the program as it's cannot continue without it!
}
return e->type;
@@ -1812,25 +1812,25 @@ void check_procedure_overloading(Checker *c, Entity *e) {
ProcTypeOverloadKind kind = are_proc_types_overload_safe(p->type, q->type);
switch (kind) {
case ProcOverload_Identical:
- error(p->token, "Overloaded procedure `%.*s` as the same type as another procedure in this scope", LIT(name));
+ error(p->token, "Overloaded procedure '%.*s' as the same type as another procedure in this scope", LIT(name));
is_invalid = true;
break;
// case ProcOverload_CallingConvention:
- // error(p->token, "Overloaded procedure `%.*s` as the same type as another procedure in this scope", LIT(name));
+ // error(p->token, "Overloaded procedure '%.*s' as the same type as another procedure in this scope", LIT(name));
// is_invalid = true;
// break;
case ProcOverload_ParamVariadic:
- error(p->token, "Overloaded procedure `%.*s` as the same type as another procedure in this scope", LIT(name));
+ error(p->token, "Overloaded procedure '%.*s' as the same type as another procedure in this scope", LIT(name));
is_invalid = true;
break;
case ProcOverload_ResultCount:
case ProcOverload_ResultTypes:
- error(p->token, "Overloaded procedure `%.*s` as the same parameters but different results in this scope", LIT(name));
+ error(p->token, "Overloaded procedure '%.*s' as the same parameters but different results in this scope", LIT(name));
is_invalid = true;
break;
case ProcOverload_Polymorphic:
#if 0
- error(p->token, "Overloaded procedure `%.*s` has a polymorphic counterpart in this scope which is not allowed", LIT(name));
+ error(p->token, "Overloaded procedure '%.*s' has a polymorphic counterpart in this scope which is not allowed", LIT(name));
is_invalid = true;
#endif
break;
@@ -1883,24 +1883,24 @@ DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) {
if (value.kind == ExactValue_String) {
auto cc = string_to_calling_convention(value.value_string);
if (cc == ProcCC_Invalid) {
- error(elem, "Unknown procedure calling convention: `%.*s`\n", LIT(value.value_string));
+ error(elem, "Unknown procedure calling convention: '%.*s'\n", LIT(value.value_string));
} else {
c->context.foreign_context.default_cc = cc;
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
} else if (name == "link_prefix") {
if (value.kind == ExactValue_String) {
String link_prefix = value.value_string;
if (!is_foreign_name_valid(link_prefix)) {
- error(elem, "Invalid link prefix: `%.*s`\n", LIT(link_prefix));
+ error(elem, "Invalid link prefix: '%.*s'\n", LIT(link_prefix));
} else {
c->context.foreign_context.link_prefix = link_prefix;
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
}
@@ -1916,7 +1916,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
error(elem, "Invalid link name: %.*s", LIT(ac->link_name));
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
} else if (name == "link_prefix") {
@@ -1926,7 +1926,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
error(elem, "Invalid link prefix: %.*s", LIT(ac->link_prefix));
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
}
@@ -1935,7 +1935,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
DECL_ATTRIBUTE_PROC(var_decl_attribute) {
if (c->context.curr_proc_decl != nullptr) {
- error(elem, "Only a variable at file scope can have a `%.*s`", LIT(name));
+ error(elem, "Only a variable at file scope can have a '%.*s'", LIT(name));
return true;
}
@@ -1946,7 +1946,7 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) {
error(elem, "Invalid link name: %.*s", LIT(ac->link_name));
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
} else if (name == "link_prefix") {
@@ -1956,7 +1956,7 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) {
error(elem, "Invalid link prefix: %.*s", LIT(ac->link_prefix));
}
} else {
- error(elem, "Expected a string value for `%.*s`", LIT(name));
+ error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
} else if (name == "thread_local") {
@@ -1973,10 +1973,10 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) {
model == "localexec") {
ac->thread_local_model = model;
} else {
- error(elem, "Invalid thread local model `%.*s`", LIT(model));
+ error(elem, "Invalid thread local model '%.*s'", LIT(model));
}
} else {
- error(elem, "Expected either no value or a string for `%.*s`", LIT(name));
+ error(elem, "Expected either no value or a string for '%.*s'", LIT(name));
}
return true;
}
@@ -2039,14 +2039,14 @@ void check_decl_attributes(Checker *c, Array<AstNode *> attributes, DeclAttribut
}
if (string_set_exists(&set, name)) {
- error(elem, "Previous declaration of `%.*s`", LIT(name));
+ error(elem, "Previous declaration of '%.*s'", LIT(name));
continue;
} else {
string_set_add(&set, name);
}
if (!proc(c, elem, name, ev, ac)) {
- error(elem, "Unknown attribute element name `%.*s`", LIT(name));
+ error(elem, "Unknown attribute element name '%.*s'", LIT(name));
}
}
}
@@ -2075,7 +2075,7 @@ bool check_arity_match(Checker *c, AstNodeValueDecl *vd, bool is_global) {
if (lhs < vd->values.count) {
AstNode *n = vd->values[lhs];
gbString str = expr_to_string(n);
- error(n, "Extra initial expression `%s`", str);
+ error(n, "Extra initial expression '%s'", str);
gb_string_free(str);
} else {
error(vd->names[0], "Extra initial expression");
@@ -2085,7 +2085,7 @@ bool check_arity_match(Checker *c, AstNodeValueDecl *vd, bool is_global) {
if (!is_global && rhs != 1) {
AstNode *n = vd->names[rhs];
gbString str = expr_to_string(n);
- error(n, "Missing expression for `%s`", str);
+ error(n, "Missing expression for '%s'", str);
gb_string_free(str);
return false;
} else if (is_global) {
@@ -2103,10 +2103,10 @@ void check_collect_entities_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
if (!ws->is_cond_determined) {
check_expr(c, &operand, ws->cond);
if (operand.mode != Addressing_Invalid && !is_type_boolean(operand.type)) {
- error(ws->cond, "Non-boolean condition in `when` statement");
+ error(ws->cond, "Non-boolean condition in 'when' statement");
}
if (operand.mode != Addressing_Constant) {
- error(ws->cond, "Non-constant condition in `when` statement");
+ error(ws->cond, "Non-constant condition in 'when' statement");
}
ws->is_cond_determined = true;
@@ -2114,7 +2114,7 @@ void check_collect_entities_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
}
if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
- error(ws->cond, "Invalid body for `when` statement");
+ error(ws->cond, "Invalid body for 'when' statement");
} else {
if (ws->determined_cond) {
check_collect_entities(c, ws->body->BlockStmt.stmts);
@@ -2127,7 +2127,7 @@ void check_collect_entities_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
check_collect_entities_from_when_stmt(c, &ws->else_stmt->WhenStmt);
break;
default:
- error(ws->else_stmt, "Invalid `else` statement in `when` statement");
+ error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -2176,7 +2176,7 @@ void check_collect_value_decl(Checker *c, AstNode *decl) {
if (vd->is_using) {
vd->is_using = false; // NOTE(bill): This error will be only caught once
- error(name, "`using` is not allowed at the file scope");
+ error(name, "'using' is not allowed at the file scope");
}
AstNode *fl = c->context.foreign_context.curr_library;
@@ -2282,7 +2282,7 @@ void check_collect_value_decl(Checker *c, AstNode *decl) {
AstNodeKind kind = init->kind;
error(name, "Only procedures and variables are allowed to be in a foreign block, got %.*s", LIT(ast_node_strings[kind]));
if (kind == AstNode_ProcType) {
- gb_printf_err("\tDid you forget to append `---` to the procedure?\n");
+ gb_printf_err("\tDid you forget to append '---' to the procedure?\n");
}
}
}
@@ -2309,7 +2309,7 @@ void check_add_foreign_block_decl(Checker *c, AstNode *decl) {
} else if (foreign_library->kind == AstNode_Implicit && foreign_library->Implicit.kind == Token_export) {
c->context.foreign_context.in_export = true;
} else {
- error(foreign_library, "Foreign block name must be an identifier or `export`");
+ error(foreign_library, "Foreign block name must be an identifier or 'export'");
c->context.foreign_context.curr_library = nullptr;
}
@@ -2386,7 +2386,7 @@ void check_collect_entities(Checker *c, Array<AstNode *> nodes) {
}
}
- // NOTE(bill): `when` stmts need to be handled after the other as the condition may refer to something
+ // NOTE(bill): 'when' stmts need to be handled after the other as the condition may refer to something
// declared after this stmt in source
if (!c->context.scope->is_file || c->context.collect_delayed_decls) {
for_array(i, nodes) {
@@ -2427,11 +2427,11 @@ void check_all_global_entities(Checker *c) {
if (e->token.string == "main") {
if (e->kind != Entity_Procedure) {
if (e->scope->is_init) {
- error(e->token, "`main` is reserved as the entry point procedure in the initial scope");
+ error(e->token, "'main' is reserved as the entry point procedure in the initial scope");
continue;
}
} else if (e->scope->is_global) {
- error(e->token, "`main` is reserved as the entry point procedure in the initial scope");
+ error(e->token, "'main' is reserved as the entry point procedure in the initial scope");
continue;
}
}
@@ -2563,7 +2563,7 @@ void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *
GB_ASSERT(found_node != nullptr);
n = *found_node;
- // TODO(bill): How should the edges be attched for `import`?
+ // TODO(bill): How should the edges be attched for 'import'?
import_graph_node_set_add(&n->succ, m);
import_graph_node_set_add(&m->pred, n);
ptr_set_add(&m->scope->imported, n->scope);
@@ -2825,7 +2825,7 @@ void check_add_export_decl(Checker *c, AstNodeExportDecl *ed) {
}
if (parent_scope->is_global) {
- error(ed->token, "`export` cannot be used on #shared_global_scope");
+ error(ed->token, "'export' cannot be used on #shared_global_scope");
return;
}
@@ -2877,10 +2877,10 @@ void check_add_foreign_import_decl(Checker *c, AstNode *decl) {
switch (file_err) {
case gbFileError_Invalid:
- error(decl, "Invalid file or cannot be found (`%.*s`)", LIT(fullpath));
+ error(decl, "Invalid file or cannot be found ('%.*s')", LIT(fullpath));
return;
case gbFileError_NotExists:
- error(decl, "File cannot be found (`%.*s`)", LIT(fullpath));
+ error(decl, "File cannot be found ('%.*s')", LIT(fullpath));
return;
}
}
@@ -2930,10 +2930,10 @@ bool collect_checked_files_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
if (!ws->is_cond_determined) {
check_expr(c, &operand, ws->cond);
if (operand.mode != Addressing_Invalid && !is_type_boolean(operand.type)) {
- error(ws->cond, "Non-boolean condition in `when` statement");
+ error(ws->cond, "Non-boolean condition in 'when' statement");
}
if (operand.mode != Addressing_Constant) {
- error(ws->cond, "Non-constant condition in `when` statement");
+ error(ws->cond, "Non-constant condition in 'when' statement");
}
ws->is_cond_determined = true;
@@ -2941,7 +2941,7 @@ bool collect_checked_files_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
}
if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
- error(ws->cond, "Invalid body for `when` statement");
+ error(ws->cond, "Invalid body for 'when' statement");
} else {
if (ws->determined_cond) {
return collect_checked_files_from_import_decl_list(c, ws->body->BlockStmt.stmts);
@@ -2952,7 +2952,7 @@ bool collect_checked_files_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
case AstNode_WhenStmt:
return collect_checked_files_from_when_stmt(c, &ws->else_stmt->WhenStmt);
default:
- error(ws->else_stmt, "Invalid `else` statement in `when` statement");
+ error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -2994,10 +2994,10 @@ bool collect_file_decls_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
if (!ws->is_cond_determined) {
check_expr(c, &operand, ws->cond);
if (operand.mode != Addressing_Invalid && !is_type_boolean(operand.type)) {
- error(ws->cond, "Non-boolean condition in `when` statement");
+ error(ws->cond, "Non-boolean condition in 'when' statement");
}
if (operand.mode != Addressing_Constant) {
- error(ws->cond, "Non-constant condition in `when` statement");
+ error(ws->cond, "Non-constant condition in 'when' statement");
}
ws->is_cond_determined = true;
@@ -3005,7 +3005,7 @@ bool collect_file_decls_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
}
if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
- error(ws->cond, "Invalid body for `when` statement");
+ error(ws->cond, "Invalid body for 'when' statement");
} else {
if (ws->determined_cond) {
return collect_file_decls(c, ws->body->BlockStmt.stmts);
@@ -3016,7 +3016,7 @@ bool collect_file_decls_from_when_stmt(Checker *c, AstNodeWhenStmt *ws) {
case AstNode_WhenStmt:
return collect_file_decls_from_when_stmt(c, &ws->else_stmt->WhenStmt);
default:
- error(ws->else_stmt, "Invalid `else` statement in `when` statement");
+ error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -3124,17 +3124,17 @@ void check_import_entities(Checker *c) {
if (path.count == 1) {
ImportPathItem item = path[0];
String filename = fn(item);
- error(item.decl, "Self importation of `%.*s`", LIT(filename));
+ error(item.decl, "Self importation of '%.*s'", LIT(filename));
} else if (path.count > 0) {
ImportPathItem item = path[path.count-1];
String filename = fn(item);
- error(item.decl, "Cyclic importation of `%.*s`", LIT(filename));
+ error(item.decl, "Cyclic importation of '%.*s'", LIT(filename));
for (isize i = 0; i < path.count; i++) {
- error(item.decl, "`%.*s` refers to", LIT(filename));
+ error(item.decl, "'%.*s' refers to", LIT(filename));
item = path[i];
filename = fn(item);
}
- error(item.decl, "`%.*s`", LIT(filename));
+ error(item.decl, "'%.*s'", LIT(filename));
}
}
@@ -3287,12 +3287,12 @@ void calculate_global_init_order(Checker *c) {
if (path.count > 0) {
Entity *e = path[0];
- error(e->token, "Cyclic initialization of `%.*s`", LIT(e->token.string));
+ error(e->token, "Cyclic initialization of '%.*s'", LIT(e->token.string));
for (isize i = path.count-1; i >= 0; i--) {
- error(e->token, "\t`%.*s` refers to", LIT(e->token.string));
+ error(e->token, "\t'%.*s' refers to", LIT(e->token.string));
e = path[i];
}
- error(e->token, "\t`%.*s`", LIT(e->token.string));
+ error(e->token, "\t'%.*s'", LIT(e->token.string));
}
}
@@ -3328,7 +3328,7 @@ void calculate_global_init_order(Checker *c) {
Entity *e = d->entities[j];
if (j == 0) gb_printf("\t");
if (j > 0) gb_printf(", ");
- gb_printf("`%.*s` %td", LIT(e->token.string), e->order_in_src);
+ gb_printf("'%.*s' %td", LIT(e->token.string), e->order_in_src);
}
gb_printf("\n");
}
@@ -3365,7 +3365,7 @@ void check_parsed_files(Checker *c) {
check_import_entities(c);
check_all_global_entities(c);
- init_preload(c); // NOTE(bill): This could be setup previously through the use of `type_info_of`
+ init_preload(c); // NOTE(bill): This could be setup previously through the use of 'type_info_of'
// Check procedure bodies
// NOTE(bill): Nested procedures bodies will be added to this "queue"
@@ -3458,7 +3458,7 @@ void check_parsed_files(Checker *c) {
token.pos.column = 1;
}
- error(token, "Undefined entry point procedure `main`");
+ error(token, "Undefined entry point procedure 'main'");
}
}
}
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index ac70b42f4..ce7a78832 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -246,7 +246,7 @@ ExactValue exact_value_from_basic_literal(Token token) {
case Token_Imag: {
String str = token.string;
Rune last_rune = cast(Rune)str[str.len-1];
- str.len--; // Ignore the `i|j|k`
+ str.len--; // Ignore the 'i|j|k'
f64 imag = float_from_string(str);
if (last_rune == 'i') {
@@ -344,7 +344,7 @@ ExactValue exact_value_make_imag(ExactValue v) {
case ExactValue_Float:
return exact_value_complex(0, v.value_float);
default:
- GB_PANIC("Expected an integer or float type for `exact_value_make_imag`");
+ GB_PANIC("Expected an integer or float type for 'exact_value_make_imag'");
}
ExactValue r = {ExactValue_Invalid};
return r;
diff --git a/src/ir.cpp b/src/ir.cpp
index 5f7333816..6a675a36c 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -93,7 +93,7 @@ struct irDefer {
irBlock * block;
union {
AstNode *stmt;
- // NOTE(bill): `instr` will be copied every time to create a new one
+ // NOTE(bill): 'instr' will be copied every time to create a new one
irValue *instr;
};
};
@@ -2268,7 +2268,7 @@ irValue *ir_emit_arith(irProcedure *proc, TokenKind op, irValue *left, irValue *
case Token_AndNot: {
// NOTE(bill): x &~ y == x & (~y) == x & (y ~ -1)
- // NOTE(bill): "not" `x` == `x` "xor" `-1`
+ // NOTE(bill): "not" 'x' == 'x' "xor" '-1'
irValue *neg = ir_add_module_constant(proc->module, type, exact_value_i64(-1));
op = Token_Xor;
right = ir_emit_arith(proc, op, right, neg, type);
@@ -2988,7 +2988,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) {
} else if (is_type_integer(dst)) {
ev = exact_value_to_integer(ev);
} else if (is_type_pointer(dst)) {
- // IMPORTANT NOTE(bill): LLVM doesn't support pointer constants expect `null`
+ // IMPORTANT NOTE(bill): LLVM doesn't support pointer constants expect 'null'
irValue *i = ir_add_module_constant(proc->module, t_uintptr, ev);
return ir_emit(proc, ir_instr_conv(proc, irConv_inttoptr, i, t_uintptr, dst));
}
@@ -3137,7 +3137,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) {
}
}
- // NOTE(bill): This has to be done before `Pointer <-> Pointer` as it's
+ // NOTE(bill): This has to be done before 'Pointer <-> Pointer' as it's
// subtype polymorphism casting
if (check_is_assignable_to_using_subtype(src_type, t)) {
Type *st = type_deref(src_type);
@@ -3281,7 +3281,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) {
gb_printf_err("Not Identical %s != %s\n", type_to_string(src), type_to_string(dst));
- GB_PANIC("Invalid type conversion: `%s` to `%s` for procedure `%.*s`",
+ GB_PANIC("Invalid type conversion: '%s' to '%s' for procedure '%.*s'",
type_to_string(src_type), type_to_string(t),
LIT(proc->name));
@@ -3338,7 +3338,7 @@ irValue *ir_emit_transmute(irProcedure *proc, irValue *value, Type *t) {
i64 sz = type_size_of(m->allocator, src);
i64 dz = type_size_of(m->allocator, dst);
- GB_ASSERT_MSG(sz == dz, "Invalid transmute conversion: `%s` to `%s`", type_to_string(src_type), type_to_string(t));
+ GB_ASSERT_MSG(sz == dz, "Invalid transmute conversion: '%s' to '%s'", type_to_string(src_type), type_to_string(t));
// NOTE(bill): Casting between an integer and a pointer cannot be done through a bitcast
if (is_type_uintptr(src) && is_type_pointer(dst)) {
@@ -3862,7 +3862,7 @@ void ir_gen_global_type_name(irModule *m, Entity *e, String name) {
#if 0
if (is_type_union(e->type)) {
Type *bt = base_type(e->type);
- // NOTE(bill): Zeroth entry is null (for `match type` stmts)
+ // NOTE(bill): Zeroth entry is null (for 'match type' stmts)
for (isize j = 1; j < bt->Struct.variant_count; j++) {
ir_mangle_add_sub_type_name(m, bt->Struct.variants[j], name);
}
@@ -3923,7 +3923,7 @@ irValue *ir_emit_clamp(irProcedure *proc, Type *t, irValue *x, irValue *min, irV
irValue *ir_find_global_variable(irProcedure *proc, String name) {
irValue **value = map_get(&proc->module->members, hash_string(name));
- GB_ASSERT_MSG(value != nullptr, "Unable to find global variable `%.*s`", LIT(name));
+ GB_ASSERT_MSG(value != nullptr, "Unable to find global variable '%.*s'", LIT(name));
return *value;
}
@@ -4298,7 +4298,7 @@ irValue *ir_build_builtin_proc(irProcedure *proc, AstNode *expr, TypeAndValue tv
} else if (is_type_string(type)) {
ptr = ir_string_elem(proc, val);
} else {
- GB_PANIC("Invalid type to `free`");
+ GB_PANIC("Invalid type to 'free'");
}
if (ptr == nullptr) {
@@ -4345,7 +4345,7 @@ irValue *ir_build_builtin_proc(irProcedure *proc, AstNode *expr, TypeAndValue tv
args[1] = capacity;
return ir_emit_global_call(proc, "__dynamic_map_reserve", args, 2);
} else {
- GB_PANIC("Unknown type for `reserve`");
+ GB_PANIC("Unknown type for 'reserve'");
}
break;
}
@@ -4372,7 +4372,7 @@ irValue *ir_build_builtin_proc(irProcedure *proc, AstNode *expr, TypeAndValue tv
irValue *count_ptr = ir_emit_struct_ep(proc, ptr, 1);
ir_emit_store(proc, count_ptr, v_zero);
} else {
- GB_PANIC("TODO(bill): ir clear for `%s`", type_to_string(t));
+ GB_PANIC("TODO(bill): ir clear for '%s'", type_to_string(t));
}
return nullptr;
break;
@@ -4778,7 +4778,7 @@ irValue *ir_build_expr(irProcedure *proc, AstNode *expr) {
GB_ASSERT_MSG(e != nullptr, "%s", expr_to_string(expr));
if (e->kind == Entity_Builtin) {
Token token = ast_node_token(expr);
- GB_PANIC("TODO(bill): ir_build_single_expr Entity_Builtin `%.*s`\n"
+ GB_PANIC("TODO(bill): ir_build_single_expr Entity_Builtin '%.*s'\n"
"\t at %.*s(%td:%td)", LIT(builtin_procs[e->Builtin.id].name),
LIT(token.pos.file), token.pos.line, token.pos.column);
return nullptr;
@@ -5715,7 +5715,7 @@ irAddr ir_build_addr(irProcedure *proc, AstNode *expr) {
case_end;
case_ast_node(ce, CallExpr, expr);
- // NOTE(bill): This is make sure you never need to have an `array_ev`
+ // NOTE(bill): This is make sure you never need to have an 'array_ev'
irValue *e = ir_build_expr(proc, expr);
irValue *v = ir_add_local_generated(proc, ir_type(e));
ir_emit_store(proc, v, e);
@@ -5772,7 +5772,7 @@ irAddr ir_build_addr(irProcedure *proc, AstNode *expr) {
case Type_Struct: {
- // TODO(bill): "constant" `#raw_union`s are not initialized constantly at the moment.
+ // TODO(bill): "constant" '#raw_union's are not initialized constantly at the moment.
// NOTE(bill): This is due to the layout of the unions when printed to LLVM-IR
bool is_raw_union = is_type_raw_union(bt);
GB_ASSERT(is_type_struct(bt) || is_raw_union);
@@ -6235,7 +6235,7 @@ void ir_build_when_stmt(irProcedure *proc, AstNodeWhenStmt *ws) {
ir_build_when_stmt(proc, &ws->else_stmt->WhenStmt);
break;
default:
- GB_PANIC("Invalid `else` statement in `when` statement");
+ GB_PANIC("Invalid 'else' statement in 'when' statement");
break;
}
}
@@ -6407,7 +6407,7 @@ void ir_build_range_string(irProcedure *proc, irValue *expr, Type *val_type,
void ir_build_range_interval(irProcedure *proc, AstNodeBinaryExpr *node, Type *val_type,
irValue **val_, irValue **idx_, irBlock **loop_, irBlock **done_) {
// TODO(bill): How should the behaviour work for lower and upper bounds checking for iteration?
- // If `lower` is changed, should `val` do so or is that not typical behaviour?
+ // If 'lower' is changed, should 'val' do so or is that not typical behaviour?
irValue *lower = ir_build_expr(proc, node->left);
irValue *upper = nullptr;
@@ -7175,8 +7175,8 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
Type *parent_type = ir_type(parent);
bool is_parent_ptr = is_type_pointer(ir_type(parent));
- MatchTypeKind match_type_kind = check_valid_type_match_type(ir_type(parent));
- GB_ASSERT(match_type_kind != MatchType_Invalid);
+ SwitchTypeKind switch_type_kind = check_valid_type_switch_type(ir_type(parent));
+ GB_ASSERT(switch_type_kind != SwitchType_Invalid);
irValue *parent_value = parent;
@@ -7187,7 +7187,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
irValue *tag_index = nullptr;
irValue *union_data = nullptr;
- if (match_type_kind == MatchType_Union) {
+ if (switch_type_kind == SwitchType_Union) {
ir_emit_comment(proc, str_lit("get union's tag"));
tag_index = ir_emit_load(proc, ir_emit_union_tag_ptr(proc, parent_ptr));
union_data = ir_emit_conv(proc, parent_ptr, t_rawptr);
@@ -7220,11 +7220,11 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
next = ir_new_block(proc, nullptr, "typeswitch.next");
case_type = type_of_expr(proc->module->info, cc->list[type_index]);
irValue *cond = nullptr;
- if (match_type_kind == MatchType_Union) {
+ if (switch_type_kind == SwitchType_Union) {
Type *ut = base_type(type_deref(parent_type));
irValue *variant_tag = ir_const_union_tag(proc->module->allocator, ut, case_type);
cond = ir_emit_comp(proc, Token_CmpEq, tag_index, variant_tag);
- } else if (match_type_kind == MatchType_Any) {
+ } else if (switch_type_kind == SwitchType_Any) {
irValue *any_ti = ir_emit_load(proc, ir_emit_struct_ep(proc, parent_ptr, 1));
irValue *case_ti = ir_type_info(proc, case_type);
cond = ir_emit_comp(proc, Token_CmpEq, any_ti, case_ti);
@@ -7250,9 +7250,9 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
}
GB_ASSERT_MSG(is_type_pointer(ct), "%s", type_to_string(ct));
irValue *data = nullptr;
- if (match_type_kind == MatchType_Union) {
+ if (switch_type_kind == SwitchType_Union) {
data = union_data;
- } else if (match_type_kind == MatchType_Any) {
+ } else if (switch_type_kind == SwitchType_Any) {
irValue *any_data = ir_emit_load(proc, ir_emit_struct_ep(proc, parent_ptr, 0));
data = any_data;
}
@@ -8713,7 +8713,7 @@ void ir_gen_tree(irGen *s) {
Type *t = type_deref(ir_type(var->var));
if (is_type_any(t)) {
- // NOTE(bill): Edge case for `any` type
+ // NOTE(bill): Edge case for 'any' type
Type *var_type = default_type(ir_type(var->init));
irValue *g = ir_add_global_generated(proc->module, var_type, var->init);
ir_emit_store(proc, g, var->init);
diff --git a/src/main.cpp b/src/main.cpp
index d3a705ab0..78fbbf178 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,7 +19,7 @@
#include "ir_print.cpp"
#if defined(GB_SYSTEM_WINDOWS)
-// NOTE(bill): `name` is used in debugging and profiling modes
+// NOTE(bill): 'name' is used in debugging and profiling modes
i32 system_exec_command_line_app(char *name, bool is_silent, char *fmt, ...) {
STARTUPINFOW start_info = {gb_size_of(STARTUPINFOW)};
PROCESS_INFORMATION pi = {0};
@@ -275,7 +275,7 @@ bool parse_build_flags(Array<String> args) {
if (bf.name == name) {
found = true;
if (set_flags[bf.kind]) {
- gb_printf_err("Previous flag set: `%.*s`\n", LIT(name));
+ gb_printf_err("Previous flag set: '%.*s'\n", LIT(name));
bad_flags = true;
} else {
ExactValue value = {};
@@ -284,11 +284,11 @@ bool parse_build_flags(Array<String> args) {
if (param.len == 0) {
ok = true;
} else {
- gb_printf_err("Flag `%.*s` was not expecting a parameter `%.*s`\n", LIT(name), LIT(param));
+ gb_printf_err("Flag '%.*s' was not expecting a parameter '%.*s'\n", LIT(name), LIT(param));
bad_flags = true;
}
} else if (param.len == 0) {
- gb_printf_err("Flag missing for `%.*s`\n", LIT(name));
+ gb_printf_err("Flag missing for '%.*s'\n", LIT(name));
bad_flags = true;
} else {
ok = true;
@@ -320,7 +320,7 @@ bool parse_build_flags(Array<String> args) {
} else if (param == "0") {
value = exact_value_bool(false);
} else {
- gb_printf_err("Invalid flag parameter for `%.*s` = `%.*s`\n", LIT(name), LIT(param));
+ gb_printf_err("Invalid flag parameter for '%.*s' = '%.*s'\n", LIT(name), LIT(param));
}
} break;
case BuildFlagParam_Integer:
@@ -408,20 +408,20 @@ bool parse_build_flags(Array<String> args) {
}
}
if (eq_pos < 0) {
- gb_printf_err("Expected `name=path`, got `%.*s`\n", LIT(param));
+ gb_printf_err("Expected 'name=path', got '%.*s'\n", LIT(param));
bad_flags = true;
break;
}
String name = substring(str, 0, eq_pos);
String path = substring(str, eq_pos+1, str.len);
if (name.len == 0 || path.len == 0) {
- gb_printf_err("Expected `name=path`, got `%.*s`\n", LIT(param));
+ gb_printf_err("Expected 'name=path', got '%.*s'\n", LIT(param));
bad_flags = true;
break;
}
if (!string_is_valid_identifier(name)) {
- gb_printf_err("Library collection name `%.*s` must be a valid identifier\n", LIT(name));
+ gb_printf_err("Library collection name '%.*s' must be a valid identifier\n", LIT(name));
bad_flags = true;
break;
}
@@ -433,7 +433,7 @@ bool parse_build_flags(Array<String> args) {
}
if (name == "system") {
- gb_printf_err("Library collection name `system` is reserved\n");
+ gb_printf_err("Library collection name 'system' is reserved\n");
bad_flags = true;
break;
}
@@ -441,7 +441,7 @@ bool parse_build_flags(Array<String> args) {
String prev_path = {};
bool found = find_library_collection_path(name, &prev_path);
if (found) {
- gb_printf_err("Library collection `%.*s` already exists with path `%.*s`\n", LIT(name), LIT(prev_path));
+ gb_printf_err("Library collection '%.*s' already exists with path '%.*s'\n", LIT(name), LIT(prev_path));
bad_flags = true;
break;
}
@@ -449,7 +449,7 @@ bool parse_build_flags(Array<String> args) {
gbAllocator a = heap_allocator();
String fullpath = path_to_fullpath(a, path);
if (!path_is_directory(fullpath)) {
- gb_printf_err("Library collection `%.*s` path must be a directory, got `%.*s`\n", LIT(name), LIT(fullpath));
+ gb_printf_err("Library collection '%.*s' path must be a directory, got '%.*s'\n", LIT(name), LIT(fullpath));
gb_free(a, fullpath.text);
bad_flags = true;
break;
@@ -470,7 +470,7 @@ bool parse_build_flags(Array<String> args) {
}
}
if (!found) {
- gb_printf_err("Unknown flag: `%.*s`\n", LIT(name));
+ gb_printf_err("Unknown flag: '%.*s'\n", LIT(name));
bad_flags = true;
}
}
@@ -552,7 +552,7 @@ int main(int arg_count, char **arg_ptr) {
init_global_error_collector();
array_init(&library_collections, heap_allocator());
- // NOTE(bill): `core` cannot be (re)defined by the user
+ // NOTE(bill): 'core' cannot be (re)defined by the user
add_library_collection(str_lit("core"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("core")));
Array<String> args = setup_args(arg_count, arg_ptr);
@@ -606,7 +606,7 @@ int main(int arg_count, char **arg_ptr) {
}
- // NOTE(bill): add `shared` directory if it is not already set
+ // NOTE(bill): add 'shared' directory if it is not already set
if (!find_library_collection_path(str_lit("shared"), nullptr)) {
add_library_collection(str_lit("shared"),
get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("shared")));
@@ -717,7 +717,7 @@ int main(int arg_count, char **arg_ptr) {
#if defined(GB_SYSTEM_OSX)
// This sets a requirement of Mountain Lion and up, but the compiler doesn't work without this limit.
// NOTE: If you change this (although this minimum is as low as you can go with Odin working)
- // make sure to also change the `macosx_version_min` param passed to `llc`
+ // make sure to also change the 'macosx_version_min' param passed to 'llc'
"-mtriple=x86_64-apple-macosx10.8 "
#endif
"",
@@ -844,17 +844,17 @@ int main(int arg_count, char **arg_ptr) {
len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " -l%.*s ", LIT(lib));
}
#else
- // NOTE(vassvik): static libraries (.a files) in linux can be linked to directly using the full path,
- // since those are statically linked to at link time. shared libraries (.so) has to be
+ // NOTE(vassvik): static libraries (.a files) in linux can be linked to directly using the full path,
+ // since those are statically linked to at link time. shared libraries (.so) has to be
// available at runtime wherever the executable is run, so we make require those to be
// local to the executable (unless the system collection is used, in which case we search
- // the system library paths for the library file).
+ // the system library paths for the library file).
if (string_has_extension(lib, str_lit("a"))) {
// static libs, absolute full path relative to the file in which the lib was imported from
isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " -l:%.*s ", LIT(lib));
} else if (string_has_extension(lib, str_lit("so"))) {
// dynamic lib, relative path to executable
- // NOTE(vassvik): it is the user's responsibility to make sure the shared library files are visible
+ // NOTE(vassvik): it is the user's responsibility to make sure the shared library files are visible
// at runtimeto the executable
isize len = gb_snprintf(lib_str_buf, gb_size_of(lib_str_buf), " -l:%s/%.*s ", cwd, LIT(lib));
} else {
@@ -902,7 +902,7 @@ int main(int arg_count, char **arg_ptr) {
#if defined(GB_SYSTEM_OSX)
// This sets a requirement of Mountain Lion and up, but the compiler doesn't work without this limit.
// NOTE: If you change this (although this minimum is as low as you can go with Odin working)
- // make sure to also change the `mtriple` param passed to `opt`
+ // make sure to also change the 'mtriple' param passed to 'opt'
" -macosx_version_min 10.8.0 "
// This points the linker to where the entry point is
" -e _main "
diff --git a/src/parser.cpp b/src/parser.cpp
index b6a86a7c0..7f3bd28d7 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -57,7 +57,7 @@ struct AstFile {
Array<AstNode *> decls;
ImportedFileKind file_kind;
bool is_global_scope;
- Array<AstNode *> imports_and_exports; // `import` `using import` `export`
+ Array<AstNode *> imports_and_exports; // 'import' 'using import' 'export'
AstNode * curr_proc;
@@ -1004,11 +1004,11 @@ AstNode *ast_binary_expr(AstFile *f, Token op, AstNode *left, AstNode *right) {
AstNode *result = make_ast_node(f, AstNode_BinaryExpr);
if (left == nullptr) {
- syntax_error(op, "No lhs expression for binary expression `%.*s`", LIT(op.string));
+ syntax_error(op, "No lhs expression for binary expression '%.*s'", LIT(op.string));
left = ast_bad_expr(f, op, op);
}
if (right == nullptr) {
- syntax_error(op, "No rhs expression for binary expression `%.*s`", LIT(op.string));
+ syntax_error(op, "No rhs expression for binary expression '%.*s'", LIT(op.string));
right = ast_bad_expr(f, op, op);
}
@@ -1706,7 +1706,7 @@ Token expect_token(AstFile *f, TokenKind kind) {
if (prev.kind != kind) {
String c = token_strings[kind];
String p = token_strings[prev.kind];
- syntax_error(f->curr_token, "Expected `%.*s`, got `%.*s`", LIT(c), LIT(p));
+ syntax_error(f->curr_token, "Expected '%.*s', got '%.*s'", LIT(c), LIT(p));
if (prev.kind == Token_EOF) {
gb_exit(1);
}
@@ -1720,7 +1720,7 @@ Token expect_token_after(AstFile *f, TokenKind kind, char *msg) {
Token prev = f->curr_token;
if (prev.kind != kind) {
String p = token_strings[prev.kind];
- syntax_error(f->curr_token, "Expected `%.*s` after %s, got `%.*s`",
+ syntax_error(f->curr_token, "Expected '%.*s' after %s, got '%.*s'",
LIT(token_strings[kind]),
msg,
LIT(p));
@@ -1733,10 +1733,10 @@ Token expect_token_after(AstFile *f, TokenKind kind, char *msg) {
Token expect_operator(AstFile *f) {
Token prev = f->curr_token;
if (!gb_is_between(prev.kind, Token__OperatorBegin+1, Token__OperatorEnd-1)) {
- syntax_error(f->curr_token, "Expected an operator, got `%.*s`",
+ syntax_error(f->curr_token, "Expected an operator, got '%.*s'",
LIT(token_strings[prev.kind]));
} else if (!f->allow_range && (prev.kind == Token_Ellipsis || prev.kind == Token_HalfClosed)) {
- syntax_error(f->curr_token, "Expected an non-range operator, got `%.*s`",
+ syntax_error(f->curr_token, "Expected an non-range operator, got '%.*s'",
LIT(token_strings[prev.kind]));
}
advance_token(f);
@@ -1746,7 +1746,7 @@ Token expect_operator(AstFile *f) {
Token expect_keyword(AstFile *f) {
Token prev = f->curr_token;
if (!gb_is_between(prev.kind, Token__KeywordBegin+1, Token__KeywordEnd-1)) {
- syntax_error(f->curr_token, "Expected a keyword, got `%.*s`",
+ syntax_error(f->curr_token, "Expected a keyword, got '%.*s'",
LIT(token_strings[prev.kind]));
}
advance_token(f);
@@ -1837,7 +1837,7 @@ Token expect_closing(AstFile *f, TokenKind kind, String context) {
if (f->curr_token.kind != kind &&
f->curr_token.kind == Token_Semicolon &&
f->curr_token.string == "\n") {
- syntax_error(f->curr_token, "Missing `,` before newline in %.*s", LIT(context));
+ syntax_error(f->curr_token, "Missing ',' before newline in %.*s", LIT(context));
advance_token(f);
}
return expect_token(f, kind);
@@ -1926,10 +1926,10 @@ void expect_semicolon(AstFile *f, AstNode *s) {
return;
}
String node_string = ast_node_strings[s->kind];
- syntax_error(prev_token, "Expected `;` after %.*s, got %.*s",
+ syntax_error(prev_token, "Expected ';' after %.*s, got %.*s",
LIT(node_string), LIT(token_strings[prev_token.kind]));
} else {
- syntax_error(prev_token, "Expected `;`");
+ syntax_error(prev_token, "Expected ';'");
}
fix_advance_to_next_stmt(f);
}
@@ -2125,7 +2125,7 @@ AstNode *convert_stmt_to_expr(AstFile *f, AstNode *statement, String kind) {
return statement->ExprStmt.expr;
}
- syntax_error(f->curr_token, "Expected `%.*s`, found a simple statement.", LIT(kind));
+ syntax_error(f->curr_token, "Expected '%.*s', found a simple statement.", LIT(kind));
Token end = f->curr_token;
if (f->tokens.count < f->curr_token_index) {
end = f->tokens[f->curr_token_index+1];
@@ -2264,7 +2264,7 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
if (pi != ProcInlining_none) {
if (expr->ProcLit.inlining != ProcInlining_none &&
expr->ProcLit.inlining != pi) {
- syntax_error(expr, "You cannot apply both `inline` and `no_inline` to a procedure literal");
+ syntax_error(expr, "You cannot apply both 'inline' and 'no_inline' to a procedure literal");
}
expr->ProcLit.inlining = pi;
}
@@ -2409,41 +2409,41 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "packed") {
if (is_packed) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_packed = true;
} else if (tag.string == "ordered") {
if (is_ordered) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_ordered = true;
} else if (tag.string == "align") {
if (align) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else if (tag.string == "raw_union") {
if (is_raw_union) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_raw_union = true;
} else {
- syntax_error(tag, "Invalid struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Invalid struct tag '#%.*s'", LIT(tag.string));
}
}
f->expr_level = prev_level;
if (is_packed && is_ordered) {
- syntax_error(token, "`#ordered` is not needed with `#packed` which implies ordering");
+ syntax_error(token, "'#ordered' is not needed with '#packed' which implies ordering");
}
if (is_raw_union && is_packed) {
is_packed = false;
- syntax_error(token, "`#raw_union` cannot also be `#packed`");
+ syntax_error(token, "'#raw_union' cannot also be '#packed'");
}
if (is_raw_union && is_ordered) {
is_ordered = false;
- syntax_error(token, "`#raw_union` cannot also be `#ordered`");
+ syntax_error(token, "'#raw_union' cannot also be '#ordered'");
}
Token open = expect_token_after(f, Token_OpenBrace, "struct");
@@ -2475,11 +2475,11 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "align") {
if (align) {
- syntax_error(tag, "Duplicate union tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate union tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else {
- syntax_error(tag, "Invalid union tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Invalid union tag '#%.*s'", LIT(tag.string));
}
}
@@ -2527,11 +2527,11 @@ AstNode *parse_operand(AstFile *f, bool lhs) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "align") {
if (align) {
- syntax_error(tag, "Duplicate bit_field tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate bit_field tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else {
- syntax_error(tag, "Invalid bit_field tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Invalid bit_field tag '#%.*s'", LIT(tag.string));
}
}
@@ -2624,7 +2624,7 @@ AstNode *parse_call_expr(AstFile *f, AstNode *operand) {
Token eq = expect_token(f, Token_Eq);
if (prefix_ellipsis) {
- syntax_error(ellipsis, "`...` must be applied to value rather than the field name");
+ syntax_error(ellipsis, "'...' must be applied to value rather than the field name");
}
AstNode *value = parse_value(f);
@@ -3259,7 +3259,7 @@ AstNode *parse_proc_type(AstFile *f, Token proc_token) {
Token token = expect_token(f, Token_String);
auto c = string_to_calling_convention(token.string);
if (c == ProcCC_Invalid) {
- syntax_error(token, "Unknown procedure calling convention: `%.*s`\n", LIT(token.string));
+ syntax_error(token, "Unknown procedure calling convention: '%.*s'\n", LIT(token.string));
} else {
cc = c;
}
@@ -3307,7 +3307,7 @@ AstNode *parse_var_type(AstFile *f, bool allow_ellipsis, bool allow_type_token)
Token tok = advance_token(f);
AstNode *type = parse_type_or_ident(f);
if (type == nullptr) {
- syntax_error(tok, "variadic field missing type after `...`");
+ syntax_error(tok, "variadic field missing type after '...'");
type = ast_bad_expr(f, tok, f->curr_token);
}
return ast_ellipsis(f, tok, type);
@@ -3382,7 +3382,7 @@ u32 parse_field_prefixes(AstFile *f) {
break;
}
if (kind == FieldPrefix_Unknown) {
- syntax_error(f->curr_token, "Unknown prefix kind `#%.*s`", LIT(f->curr_token.string));
+ syntax_error(f->curr_token, "Unknown prefix kind '#%.*s'", LIT(f->curr_token.string));
advance_token(f);
continue;
}
@@ -3394,10 +3394,10 @@ u32 parse_field_prefixes(AstFile *f) {
case FieldPrefix_const: const_count += 1; advance_token(f); break;
}
}
- if (using_count > 1) syntax_error(f->curr_token, "Multiple `using` in this field list");
- if (no_alias_count > 1) syntax_error(f->curr_token, "Multiple `#no_alias` in this field list");
- if (c_vararg_count > 1) syntax_error(f->curr_token, "Multiple `#c_vararg` in this field list");
- if (const_count > 1) syntax_error(f->curr_token, "Multiple `#const` in this field list");
+ if (using_count > 1) syntax_error(f->curr_token, "Multiple 'using' in this field list");
+ if (no_alias_count > 1) syntax_error(f->curr_token, "Multiple '#no_alias' in this field list");
+ if (c_vararg_count > 1) syntax_error(f->curr_token, "Multiple '#c_vararg' in this field list");
+ if (const_count > 1) syntax_error(f->curr_token, "Multiple '#const' in this field list");
u32 field_flags = 0;
@@ -3410,24 +3410,24 @@ u32 parse_field_prefixes(AstFile *f) {
u32 check_field_prefixes(AstFile *f, isize name_count, u32 allowed_flags, u32 set_flags) {
if (name_count > 1 && (set_flags&FieldFlag_using)) {
- syntax_error(f->curr_token, "Cannot apply `using` to more than one of the same type");
+ syntax_error(f->curr_token, "Cannot apply 'using' to more than one of the same type");
set_flags &= ~FieldFlag_using;
}
if ((allowed_flags&FieldFlag_using) == 0 && (set_flags&FieldFlag_using)) {
- syntax_error(f->curr_token, "`using` is not allowed within this field list");
+ syntax_error(f->curr_token, "'using' is not allowed within this field list");
set_flags &= ~FieldFlag_using;
}
if ((allowed_flags&FieldFlag_no_alias) == 0 && (set_flags&FieldFlag_no_alias)) {
- syntax_error(f->curr_token, "`#no_alias` is not allowed within this field list");
+ syntax_error(f->curr_token, "'#no_alias' is not allowed within this field list");
set_flags &= ~FieldFlag_no_alias;
}
if ((allowed_flags&FieldFlag_c_vararg) == 0 && (set_flags&FieldFlag_c_vararg)) {
- syntax_error(f->curr_token, "`#c_vararg` is not allowed within this field list");
+ syntax_error(f->curr_token, "'#c_vararg' is not allowed within this field list");
set_flags &= ~FieldFlag_c_vararg;
}
if ((allowed_flags&FieldFlag_const) == 0 && (set_flags&FieldFlag_const)) {
- syntax_error(f->curr_token, "`$` is not allowed within this field list");
+ syntax_error(f->curr_token, "'$' is not allowed within this field list");
set_flags &= ~FieldFlag_const;
}
return set_flags;
@@ -3795,28 +3795,28 @@ AstNode *parse_type_or_ident(AstFile *f) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "packed") {
if (is_packed) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_packed = true;
} else if (tag.string == "ordered") {
if (is_ordered) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_ordered = true;
} else if (tag.string == "align") {
if (align) {
- syntax_error(tag, "Duplicate struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else {
- syntax_error(tag, "Invalid struct tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Invalid struct tag '#%.*s'", LIT(tag.string));
}
}
f->expr_level = prev_level;
if (is_packed && is_ordered) {
- syntax_error(token, "`#ordered` is not needed with `#packed` which implies ordering");
+ syntax_error(token, "'#ordered' is not needed with '#packed' which implies ordering");
}
Token open = expect_token_after(f, Token_OpenBrace, "struct");
@@ -3904,11 +3904,11 @@ AstNode *parse_type_or_ident(AstFile *f) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "align") {
if (align) {
- syntax_error(tag, "Duplicate bit_field tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Duplicate bit_field tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else {
- syntax_error(tag, "Invalid bit_field tag `#%.*s`", LIT(tag.string));
+ syntax_error(tag, "Invalid bit_field tag '#%.*s'", LIT(tag.string));
}
}
@@ -4329,7 +4329,7 @@ AstNode *parse_defer_stmt(AstFile *f) {
AstNode *stmt = parse_stmt(f);
switch (stmt->kind) {
case AstNode_EmptyStmt:
- syntax_error(token, "Empty statement after defer (e.g. `;`)");
+ syntax_error(token, "Empty statement after defer (e.g. ';')");
break;
case AstNode_DeferStmt:
syntax_error(token, "You cannot defer a defer statement");
@@ -4385,14 +4385,14 @@ AstNode *parse_import_decl(AstFile *f, bool is_using) {
}
if (!is_using && is_blank_ident(import_name)) {
- syntax_error(import_name, "Illegal import name: `_`");
+ syntax_error(import_name, "Illegal import name: '_'");
}
Token file_path = expect_token_after(f, Token_String, "import");
AstNode *s = nullptr;
if (f->curr_proc != nullptr) {
- syntax_error(import_name, "You cannot use `import` within a procedure. This must be done at the file scope");
+ syntax_error(import_name, "You cannot use 'import' within a procedure. This must be done at the file scope");
s = ast_bad_decl(f, import_name, file_path);
} else {
s = ast_import_decl(f, token, is_using, file_path, import_name, docs, f->line_comment);
@@ -4408,7 +4408,7 @@ AstNode *parse_export_decl(AstFile *f) {
Token file_path = expect_token_after(f, Token_String, "export");
AstNode *s = nullptr;
if (f->curr_proc != nullptr) {
- syntax_error(token, "You cannot use `export` within a procedure. This must be done at the file scope");
+ syntax_error(token, "You cannot use 'export' within a procedure. This must be done at the file scope");
s = ast_bad_decl(f, token, file_path);
} else {
s = ast_export_decl(f, token, file_path, docs, f->line_comment);
@@ -4439,7 +4439,7 @@ AstNode *parse_foreign_decl(AstFile *f) {
break;
}
if (is_blank_ident(lib_name)) {
- syntax_error(lib_name, "Illegal foreign_library name: `_`");
+ syntax_error(lib_name, "Illegal foreign_library name: '_'");
}
Token file_path = expect_token(f, Token_String);
AstNode *s = nullptr;
@@ -4545,7 +4545,7 @@ AstNode *parse_stmt(AstFile *f) {
AstNode *decl = nullptr;
Array<AstNode *> list = parse_lhs_expr_list(f);
if (list.count == 0) {
- syntax_error(token, "Illegal use of `using` statement");
+ syntax_error(token, "Illegal use of 'using' statement");
expect_semicolon(f, nullptr);
return ast_bad_stmt(f, token, f->curr_token);
}
@@ -4558,14 +4558,14 @@ AstNode *parse_stmt(AstFile *f) {
if (decl != nullptr && decl->kind == AstNode_ValueDecl) {
if (!decl->ValueDecl.is_mutable) {
- syntax_error(token, "`using` may only be applied to variable declarations");
+ syntax_error(token, "'using' may only be applied to variable declarations");
return decl;
}
decl->ValueDecl.is_using = true;
return decl;
}
- syntax_error(token, "Illegal use of `using` statement");
+ syntax_error(token, "Illegal use of 'using' statement");
return ast_bad_stmt(f, token, f->curr_token);
} break;
@@ -4644,10 +4644,10 @@ AstNode *parse_stmt(AstFile *f) {
}
if (tag == "include") {
- syntax_error(token, "#include is not a valid import declaration kind. Did you mean `import`?");
+ syntax_error(token, "#include is not a valid import declaration kind. Did you mean 'import'?");
s = ast_bad_stmt(f, token, f->curr_token);
} else {
- syntax_error(token, "Unknown tag directive used: `%.*s`", LIT(tag));
+ syntax_error(token, "Unknown tag directive used: '%.*s'", LIT(tag));
s = ast_bad_stmt(f, token, f->curr_token);
}
@@ -4666,7 +4666,7 @@ AstNode *parse_stmt(AstFile *f) {
}
syntax_error(token,
- "Expected a statement, got `%.*s`",
+ "Expected a statement, got '%.*s'",
LIT(token_strings[token.kind]));
fix_advance_to_next_stmt(f);
return ast_bad_stmt(f, token, f->curr_token);
@@ -4886,7 +4886,7 @@ bool determine_path_from_string(Parser *p, AstNode *node, String base_dir, Strin
}
if (!is_import_path_valid(file_str)) {
- syntax_error(node, "Invalid import path: `%.*s`", LIT(file_str));
+ syntax_error(node, "Invalid import path: '%.*s'", LIT(file_str));
return false;
}
@@ -4901,7 +4901,7 @@ bool determine_path_from_string(Parser *p, AstNode *node, String base_dir, Strin
if (collection_name.len > 0) {
if (collection_name == "system") {
if (node->kind != AstNode_ForeignImportDecl) {
- syntax_error(node, "The library collection `system` is restrict for `foreign_library`");
+ syntax_error(node, "The library collection 'system' is restrict for 'foreign_library'");
return false;
} else {
*path = file_str;
@@ -4909,7 +4909,7 @@ bool determine_path_from_string(Parser *p, AstNode *node, String base_dir, Strin
}
} else if (!find_library_collection_path(collection_name, &base_dir)) {
// NOTE(bill): It's a naughty name
- syntax_error(node, "Unknown library collection: `%.*s`", LIT(collection_name));
+ syntax_error(node, "Unknown library collection: '%.*s'", LIT(collection_name));
return false;
}
} else {
@@ -5071,7 +5071,7 @@ ParseFileError parse_import(Parser *p, ImportedFile imported_file) {
gb_printf_err("Failed to parse file: %.*s\n\t", LIT(import_rel_path));
switch (err) {
case ParseFile_WrongExtension:
- gb_printf_err("Invalid file extension: File must have the extension `.odin`");
+ gb_printf_err("Invalid file extension: File must have the extension '.odin'");
break;
case ParseFile_InvalidFile:
gb_printf_err("Invalid file or cannot be found");
@@ -5080,7 +5080,7 @@ ParseFileError parse_import(Parser *p, ImportedFile imported_file) {
gb_printf_err("File permissions problem");
break;
case ParseFile_NotFound:
- gb_printf_err("File cannot be found (`%.*s`)", LIT(import_path));
+ gb_printf_err("File cannot be found ('%.*s')", LIT(import_path));
break;
case ParseFile_InvalidToken:
gb_printf_err("Invalid token found in file at (%td:%td)", err_pos.line, err_pos.column);