Beispiel #1
0
TEST(Type, RelaxType) {
  EXPECT_EQ(Type::Gen, relaxType(Type::BoxedStr, {DataTypeGeneric}));
  EXPECT_EQ(Type::BoxedInitCell | Type::Uncounted,
            relaxType(Type::BoxedObj | Type::InitNull,
                      {DataTypeCountness, DataTypeGeneric}));


  auto inner = TypeConstraint{DataTypeSpecialized};
  inner.setDesiredClass(SystemLib::s_IteratorClass);
  inner.innerCat = DataTypeSpecialized;
  inner.category = DataTypeSpecific;
  auto type = Type::Obj.specialize(SystemLib::s_IteratorClass).box();
  EXPECT_EQ("BoxedObj<Iterator>", type.toString());
  EXPECT_EQ(type, relaxType(type, inner));
}
Beispiel #2
0
TEST(Type, RelaxType) {
  EXPECT_EQ(Type::Gen, relaxType(Type::BoxedStr, {DataTypeGeneric}));
  EXPECT_EQ(Type::BoxedInitCell | Type::Uncounted,
            relaxType(Type::BoxedObj | Type::InitNull,
                      {DataTypeCountness}));


  auto tc = TypeConstraint{DataTypeSpecialized};
  tc.setDesiredClass(SystemLib::s_IteratorClass);
  tc.category = DataTypeSpecialized;
  auto type = Type::Obj.specialize(SystemLib::s_IteratorClass);
  EXPECT_EQ("Obj<=Iterator", type.toString());
  EXPECT_EQ(type, relaxType(type, tc));

  EXPECT_EQ(Type::BoxedInitCell,
            relaxType(Type::BoxedInitCell, DataTypeCountnessInit));
  EXPECT_EQ(Type::BoxedInitCell,
            relaxType(Type::BoxedInitCell, DataTypeCountness));
}