37# include <gtest/gtest.h>
68 const auto result = unifier.
unify(lhs, rhs);
86 EXPECT_EQ(result.kind, Compiler_Unify_Result_Kind::Occurs_Check_Failed);
98 EXPECT_EQ(result.kind, Compiler_Unify_Result_Kind::Rigid_Variable);
117 const auto result = unifier.
solve(constraints);
137 const auto result = unifier.
solve(constraints);
Context owning all compiler type nodes.
Compiler_Type_Id string_type() const noexcept
Returns the preloaded String type id.
std::string to_string(const Compiler_Type_Id id) const
Renders one type to a deterministic human-readable string.
Compiler_Type_Id make_type_variable(std::string label="", const bool rigid=false)
Creates a fresh type variable.
Compiler_Type_Id make_tuple_type(const DynArray< Compiler_Type_Id > &members)
Creates a tuple type.
Compiler_Type_Id make_function_type(const DynArray< Compiler_Type_Id > ¶meters, const Compiler_Type_Id result)
Creates a function type.
Compiler_Type_Id bool_type() const noexcept
Returns the preloaded Bool type id.
Compiler_Type_Id integer_type() const noexcept
Returns the preloaded Int type id.
Structural unifier for compiler types.
std::string dump_substitution()
Dumps the current substitution in a deterministic format.
Compiler_Unify_Result unify(const Compiler_Type_Id lhs, const Compiler_Type_Id rhs)
Attempts to unify lhs and rhs.
Compiler_Unify_Result solve(const Compiler_Type_Constraint_Set &constraints)
Solves a whole ordered set of type constraints.
Compiler_Type_Id apply(const Compiler_Type_Id id)
Applies the current substitution to id.
Ordered collection of equality constraints.
size_t add(const T &lhs, const T &rhs, const Source_Span &span={}, const std::string &message="")
Appends an equality constraint.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Equality constraints and type unification helpers for compiler work.