78 const auto result = unifier.
solve(constraints);
86 std::cout <<
"Normalized inferred type: "
92 std::cout <<
"Unification failed: "
94 <<
" - " << result.message
Stable type graph for the compiler-support MVP.
Context owning all compiler type nodes.
void set_struct_fields(const Compiler_Type_Id id, const DynArray< std::string > &field_names, const DynArray< Compiler_Type_Id > &field_types) const
Assigns field metadata to a previously created struct type.
std::string to_string(const Compiler_Type_Id id) const
Renders one type to a deterministic human-readable string.
Compiler_Type_Id make_enum_type(std::string name)
Creates a nominal enum type placeholder.
std::string dump_types() const
Dumps all known types in allocation order.
void set_enum_variants(const Compiler_Type_Id id, const DynArray< std::string > &variant_names) const
Assigns variant metadata to a previously created enum type.
Compiler_Type_Id make_type_variable(std::string label="", const bool rigid=false)
Creates a fresh type variable.
Compiler_Type_Id make_function_type(const DynArray< Compiler_Type_Id > ¶meters, const Compiler_Type_Id result)
Creates a function type.
Compiler_Type_Id integer_type() const noexcept
Returns the preloaded Int type id.
Compiler_Type_Id make_struct_type(std::string name)
Creates a nominal struct type placeholder.
Structural unifier for compiler types.
std::string dump_substitution()
Dumps the current substitution in a deterministic format.
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.
T & append()
Allocate a new entry to the end of array.
Minimal std::expected-style result type for C++20.
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.
const char * compiler_unify_result_kind_name(const Compiler_Unify_Result_Kind kind) noexcept
Returns a stable debug name for one unification result kind.
static long & color(typename GT::Node *p)
Equality constraints and type unification helpers for compiler work.