bool literals, fixes

This commit is contained in:
ProgramSnail 2023-05-08 20:34:36 +03:00
parent b1aff1935d
commit d31979166e
24 changed files with 179 additions and 46 deletions

View file

@ -1,7 +1,9 @@
#include <optional>
// for clangd
#include "../include/link_symbols_visitor.hpp"
#include "../include/error_handling.hpp"
#include <optional>
#include "../include/types.hpp"
namespace interpreter {
@ -50,8 +52,20 @@ void LinkSymbolsVisitor::Visit(TypeExpression* node) { // TODO: check
node->type_id_ = namespace_visitor_.FindType(path, node->type.type);
node->constructor_id_ = namespace_visitor_.FindConstructor(path, node->type.type);
// internal type
if (info::type::ToInternalType(node->type.type).has_value()) {
if (!node->path.empty()) {
error_handling::HandleTypecheckError("Internal type is not in namespace", node->base);
}
if (!node->type.parameters.empty()) {
error_handling::HandleTypecheckError("Can't parametrize internal type", node->base);
}
return;
}
// abstract / basic / TODO: local abstract type
if (path.size() == 0 && namespace_visitor_.FindAbstractType(node->type.type).has_value()) { // TODO
// abstract / basic / TODO: local abstract type
return;
}