type_check_visitor fixes

This commit is contained in:
ProgramSnail 2023-05-09 16:01:01 +03:00
parent ab29a785bf
commit 359a65310b

View file

@ -888,10 +888,13 @@ void TypeCheckVisitor::Visit(VariantExpression* node) {
}
current_type_ = context_manager_.AddValue(info::type::VariantType(std::nullopt, constructors, -1),
current_type_ = context_manager_.AddValue(info::type::VariantType(std::nullopt,
constructors,
std::nullopt),
utils::ValueType::Tmp);
current_type_ = context_manager_.AddValue(info::type::VariantType(std::nullopt, constructors, -1),
current_type_ = context_manager_.AddValue(info::type::OptionalType(current_type_,
context_manager_.GetValueManager()),
utils::ValueType::Tmp);
node->base.type_ = current_type_;
@ -1239,7 +1242,9 @@ void TypeCheckVisitor::Visit(VariantType* node) {
}
}
current_type_ = context_manager_.AddValue(info::type::VariantType(node->type, constructors, -1),
current_type_ = context_manager_.AddValue(info::type::VariantType(node->type,
constructors,
std::nullopt),
utils::ValueType::Tmp);
node->base.type_ = current_type_;