mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Fix #2186
This commit is contained in:
+7
-10
@@ -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
|
// TODO(bill): Determine which rule is a better on in practice
|
||||||
#if 1
|
if (dst->Union.variants.count == 1) {
|
||||||
if (dst->Union.variants.count == 1) {
|
Type *vt = dst->Union.variants[0];
|
||||||
Type *vt = dst->Union.variants[0];
|
i64 score = check_distance_between_types(c, operand, vt);
|
||||||
i64 score = check_distance_between_types(c, operand, vt);
|
if (score >= 0) {
|
||||||
if (score >= 0) {
|
return score+2;
|
||||||
return score+2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
} else if (is_type_untyped(src)) {
|
||||||
// NOTE(bill): check to see you can assign to it with one of the variants?
|
|
||||||
i64 prev_lowest_score = -1;
|
i64 prev_lowest_score = -1;
|
||||||
i64 lowest_score = -1;
|
i64 lowest_score = -1;
|
||||||
for_array(i, dst->Union.variants) {
|
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;
|
return lowest_score+2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_type_relative_pointer(dst)) {
|
if (is_type_relative_pointer(dst)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user