aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 42495d682..c9a1ad4d8 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -946,8 +946,8 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
if (switch_kind == TypeSwitch_Union) {
GB_ASSERT(is_type_union(bt));
bool tag_type_found = false;
- for_array(i, bt->Union.variants) {
- Type *vt = bt->Union.variants[i];
+ for_array(j, bt->Union.variants) {
+ Type *vt = bt->Union.variants[j];
if (are_types_identical(vt, y.type)) {
tag_type_found = true;
break;
@@ -955,7 +955,11 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_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 variant type, got '%s'", type_str);
+ for_array(j, bt->Union.variants) {
+ Type *vt = base_type(bt->Union.variants[j]);
+ gb_printf_err("\t%s\n", type_to_string(vt));
+ }
gb_string_free(type_str);
continue;
}