Explorar o código

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.
korvahkh hai 7 meses
pai
achega
1281303ff7
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/check_builtin.cpp

+ 3 - 0
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;
 		}