aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-11-21 11:30:21 +0000
committergingerBill <bill@gingerbill.org>2022-11-21 11:30:21 +0000
commit0b33df4e9d7facb9f3b8840409209ec44760bb8b (patch)
tree39e652a65cf2762fe070052477dabd88bc824db4 /src/check_expr.cpp
parent4c4049574243575ceddf7e0e0a0516483d56f41f (diff)
Fix #2186
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index ecd7d4412..0ee1ea2a2 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -765,16 +765,13 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
}
// TODO(bill): Determine which rule is a better on in practice
- #if 1
- if (dst->Union.variants.count == 1) {
- Type *vt = dst->Union.variants[0];
- i64 score = check_distance_between_types(c, operand, vt);
- if (score >= 0) {
- return score+2;
- }
+ if (dst->Union.variants.count == 1) {
+ Type *vt = dst->Union.variants[0];
+ i64 score = check_distance_between_types(c, operand, vt);
+ if (score >= 0) {
+ return score+2;
}
- #else
- // NOTE(bill): check to see you can assign to it with one of the variants?
+ } else if (is_type_untyped(src)) {
i64 prev_lowest_score = -1;
i64 lowest_score = -1;
for_array(i, dst->Union.variants) {
@@ -798,7 +795,7 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
return lowest_score+2;
}
}
- #endif
+ }
}
if (is_type_relative_pointer(dst)) {