// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #pragma once #include "Luau/NotNull.h" #include "Luau/TypedAllocator.h" #include "Luau/Variant.h" #include "Luau/TypeFwd.h" namespace Luau { struct RefinementKey; using DefId = NotNull; struct Variadic; struct Negation; struct Conjunction; struct Disjunction; struct Equivalence; struct Proposition; using Refinement = Variant; using RefinementId = Refinement*; // Can and most likely is nullptr. struct Variadic { std::vector refinements; }; struct Negation { RefinementId refinement; }; struct Conjunction { RefinementId lhs; RefinementId rhs; }; struct Disjunction { RefinementId lhs; RefinementId rhs; }; struct Equivalence { RefinementId lhs; RefinementId rhs; }; struct Proposition { const RefinementKey* key; TypeId discriminantTy; }; template const T* get(RefinementId refinement) { return get_if(refinement); } struct RefinementArena { RefinementId variadic(const std::vector& refis); RefinementId negation(RefinementId refinement); RefinementId conjunction(RefinementId lhs, RefinementId rhs); RefinementId disjunction(RefinementId lhs, RefinementId rhs); RefinementId equivalence(RefinementId lhs, RefinementId rhs); RefinementId proposition(const RefinementKey* key, TypeId discriminantTy); private: TypedAllocator allocator; }; } // namespace Luau