souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
29 using namespace analysis;
31 TEST(TypeSystem, Basic) {
34 const analysis::Type& A = env.createType<SubsetType>(
"A", env.getType(
"number"));
35 const analysis::Type& B = env.createType<SubsetType>(
"B", env.getType(
"symbol"));
49 TEST(TypeSystem, isNumberType) {
88 TEST(TypeSystem, isSubtypeOf_Basic) {
138 TEST(TypeSystem, isSubtypeOf_Records) {
157 TEST(TypeSystem, GreatestCommonSubtype) {
232 TEST(TypeSystem, complexSubsetTypes) {
245 for (
size_t i = 1;
i <= 10; ++
i) {
251 TEST(TypeSystem, RecordSubsets) {
254 auto& R = env.createType<RecordType>(
"R");
256 auto& A = env.createType<SubsetType>(
"A", R);
262 TEST(TypeSystem, EquivTypes) {
bool isOfKind(const Type &type, TypeAttribute kind)
Check if the type is of a kind corresponding to the TypeAttribute.
bool areEquivalentTypes(const Type &a, const Type &b)
Determine if two types are equivalent.
const Type & getType(const QualifiedName &) const
A type being a subset of another type.
A union type combining a list of types into a new, aggregated type.
An abstract base class for types to be covered within a type environment.
bool isNotSubtypeOf(const analysis::Type &a, const analysis::Type &b)
A record type combining a list of fields into a new, aggregated type.
TypeSet getGreatestCommonSubtypes(const Type &a, const Type &b)
Computes the greatest common sub types of the two given types.
const std::string & toString(const std::string &str)
A generic function converting strings into strings (trivial case).
static TypeConstraint isSubtypeOf(const TypeVar &a, const TypeVar &b)
A constraint factory ensuring that all the types associated to the variable a are subtypes of the var...
A type environment is a set of types.
#define EXPECT_PRED2(p, a, b)
std::vector< T > toVector()
A utility function enabling the creation of a vector with a fixed set of elements within a single exp...
l j a showGridBackground &&c b raw series this eventEmitter b
T & createType(const QualifiedName &name, Args &&... args)
create type in this environment
void setFields(std::vector< const Type * > newFields)
Combination of types using sums and products.
void setElements(std::vector< const Type * > elements)