fn(variants$0, env$1, index$2, seen_tags$3) =>
match @core.list-get(list: $0, index: $2) {
#none(_) =>
#ok(#type),
#some(item$1023) =>
match @core.list-contains-string(list: $3, target: $1023.tag, index: 0) {
true =>
#error(#invalid_type_declaration({message: "duplicate variant tag in union type"})),
false =>
match $1023.payload_type {
#none(_) =>
@core.type-check-type-union-variants(
variants: $0,
env: $1,
index: @core.plus(left: $2, right: 1),
seen_tags: @core.list-append(list: $3, item: $1023.tag)
),
#some(payload_expr$20) =>
match @core.type-check-against(expr: $20, env: $1, expected_type: #type) {
#ok(ok_type$21) =>
@core.type-check-type-union-variants(
variants: $0,
env: $1,
index: @core.plus(left: $2, right: 1),
seen_tags: @core.list-append(list: $3, item: $1023.tag)
),
#error(err$22) =>
#error($22),
_ =>
#error(#unknown_error)
},
_ =>
#error(#unknown_error)
}
}
}