From 35e70f4be17f4123ec25108d664864f13b38087e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 27 Sep 2022 22:30:00 +0100 Subject: [PATCH] Add node data for union when using `intrinsics.type_convert_variants_to_pointers` --- src/check_builtin.cpp | 1 + src/docs_writer.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 09294c93a..a00dd5def 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -4751,6 +4751,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 new_type->Union.variants = variants; // NOTE(bill): Is this even correct? + new_type->Union.node = operand->expr; new_type->Union.scope = bt->Union.scope; operand->type = new_type; diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp index 1b8e1fc34..5246971ff 100644 --- a/src/docs_writer.cpp +++ b/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); } - if (type->Union.node) { + if (type->Union.node && type->Union.node->kind == Ast_UnionType) { ast_node(ut, UnionType, type->Union.node); if (ut->align) { doc_type.custom_align = odin_doc_expr_string(w, ut->align);