gingerBill %!s(int64=2) %!d(string=hai) anos
pai
achega
64047cbf05
Modificáronse 1 ficheiros con 4 adicións e 3 borrados
  1. 4 3
      core/reflect/reflect.odin

+ 4 - 3
core/reflect/reflect.odin

@@ -661,9 +661,10 @@ union_variant_typeid :: proc(a: any) -> typeid {
 		case: unimplemented()
 		}
 
-		if a.data != nil && tag != 0 {
-			i := tag if info.no_nil else tag-1
-			return info.variants[i].id
+		if info.no_nil {
+			return info.variants[tag].id
+		} else if tag != 0 {
+			return info.variants[tag-1].id
 		}
 
 		return nil