start type narrowing for binary exprs

This commit is contained in:
2026-08-02 18:03:31 +10:00
parent cf79fd00b9
commit 9bee018c09
2 changed files with 145 additions and 2 deletions

View File

@@ -8,6 +8,13 @@
namespace Solstice {
enum class Narrowing {
None,
Left,
Right,
Both
};
class TypeChecker {
std::unordered_map<std::string, PossibleType> variables;
std::unordered_map<std::string, Type> types;
@@ -37,6 +44,9 @@ namespace Solstice {
void checkCodeBlockType(Node& node);
Narrowing doesNodeChildrenNeedNarrowing(Node& node);
void narrowBinaryNode(Node& node, std::unordered_map<TypePair, Type>& overloads);
void checkAddType(Node& node);
void checkSubtractType(Node& node);
void checkMultiplyType(Node& node);