Browse Source

Add node data for union when using `intrinsics.type_convert_variants_to_pointers`

gingerBill 2 years ago
parent
commit
35e70f4be1
2 changed files with 2 additions and 1 deletions
  1. 1 0
      src/check_builtin.cpp
  2. 1 1
      src/docs_writer.cpp

+ 1 - 0
src/check_builtin.cpp

@@ -4751,6 +4751,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
 			new_type->Union.variants = variants;
 			new_type->Union.variants = variants;
 
 
 			// NOTE(bill): Is this even correct?
 			// NOTE(bill): Is this even correct?
+			new_type->Union.node = operand->expr;
 			new_type->Union.scope = bt->Union.scope;
 			new_type->Union.scope = bt->Union.scope;
 
 
 			operand->type = new_type;
 			operand->type = new_type;

+ 1 - 1
src/docs_writer.cpp

@@ -639,7 +639,7 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
 			doc_type.polmorphic_params = odin_doc_type(w, type->Union.polymorphic_params);
 			doc_type.polmorphic_params = odin_doc_type(w, type->Union.polymorphic_params);
 		}
 		}
 
 
-		if (type->Union.node) {
+		if (type->Union.node && type->Union.node->kind == Ast_UnionType) {
 			ast_node(ut, UnionType, type->Union.node);
 			ast_node(ut, UnionType, type->Union.node);
 			if (ut->align) {
 			if (ut->align) {
 				doc_type.custom_align = odin_doc_expr_string(w, ut->align);
 				doc_type.custom_align = odin_doc_expr_string(w, ut->align);