aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorkorvahkh <92224397+korvahkh@users.noreply.github.com>2025-02-03 16:08:19 -0600
committerkorvahkh <92224397+korvahkh@users.noreply.github.com>2025-02-03 16:08:19 -0600
commit1281303ff756ce4a83dcdb20be6154c7a72f278f (patch)
tree2bd7d809a8ff26d4236a453fc1697e1fc6264940 /src/check_builtin.cpp
parent0e1c89e99bcd31f58e12a0b13db5f83150f53e9f (diff)
Preserve `#no_nil` in `intrinsics.type_convert_variants_to_pointers`
Previously the newly returned type would not be marked as `#no_nil`. This caused `reflect.get_union_as_ptr_variants` to break on `#no_nil` unions.
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index ea902387b..7d0ce3aef 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -5544,6 +5544,9 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
// NOTE(bill): Is this even correct?
new_type->Union.node = operand->expr;
new_type->Union.scope = bt->Union.scope;
+ if (bt->Union.kind == UnionType_no_nil) {
+ new_type->Union.kind = UnionType_no_nil;
+ }
operand->type = new_type;
}