diff options
| author | korvahkh <92224397+korvahkh@users.noreply.github.com> | 2025-02-03 16:08:19 -0600 |
|---|---|---|
| committer | korvahkh <92224397+korvahkh@users.noreply.github.com> | 2025-02-03 16:08:19 -0600 |
| commit | 1281303ff756ce4a83dcdb20be6154c7a72f278f (patch) | |
| tree | 2bd7d809a8ff26d4236a453fc1697e1fc6264940 | |
| parent | 0e1c89e99bcd31f58e12a0b13db5f83150f53e9f (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.
| -rw-r--r-- | src/check_builtin.cpp | 3 |
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; } |