Răsfoiți Sursa

meta: ::identifier renamed to ::alias, added meta_type::id to get the id of the underlying type (close #412)

Michele Caini 6 ani în urmă
părinte
comite
e52b3fd5bc

+ 32 - 26
src/entt/meta/factory.hpp

@@ -378,28 +378,34 @@ class meta_factory<Type> {
     }
 
     template<typename Node>
-    bool exists(const ENTT_ID_TYPE identifier, const Node *node) ENTT_NOEXCEPT {
-        return node && (node->identifier == identifier || exists(identifier, node->next));
+    bool exists(const ENTT_ID_TYPE alias, const Node *node) ENTT_NOEXCEPT {
+        return node && (node->alias == alias || exists(alias, node->next));
     }
 
 public:
     /**
-     * @brief Extends a meta type by assigning it an identifier.
-     * @param identifier Unique identifier.
+     * @brief Extends a meta type by assigning it an alias.
+     * @param value Unique identifier.
      * @return An extended meta factory for the given type.
      */
-    auto type(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
+    auto alias(const ENTT_ID_TYPE value) ENTT_NOEXCEPT {
         auto * const node = internal::meta_info<Type>::resolve();
 
-        ENTT_ASSERT(!exists(identifier, *internal::meta_info<>::global));
+        ENTT_ASSERT(!exists(value, *internal::meta_info<>::global));
         ENTT_ASSERT(!exists(node, *internal::meta_info<>::global));
-        node->identifier = identifier;
+        node->alias = value;
         node->next = *internal::meta_info<>::global;
         *internal::meta_info<>::global = node;
 
         return meta_factory<Type, Type>{&node->prop};
     }
 
+    /*! @copydoc alias */
+    [[deprecated("Use ::alias instead")]]
+    auto type(const ENTT_ID_TYPE value) ENTT_NOEXCEPT {
+        return alias(value);
+    }
+
     /**
      * @brief Assigns a meta base to a meta type.
      *
@@ -608,11 +614,11 @@ public:
      *
      * @tparam Data The actual variable to attach to the meta type.
      * @tparam Policy Optional policy (no policy set by default).
-     * @param identifier Unique identifier.
+     * @param alias Unique identifier.
      * @return An extended meta factory for the parent type.
      */
     template<auto Data, typename Policy = as_is_t>
-    auto data(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
+    auto data(const ENTT_ID_TYPE alias) ENTT_NOEXCEPT {
         auto * const type = internal::meta_info<Type>::resolve();
         internal::meta_data_node *curr = nullptr;
 
@@ -667,9 +673,9 @@ public:
             curr = &node;
         }
 
-        ENTT_ASSERT(!exists(identifier, type->data));
+        ENTT_ASSERT(!exists(alias, type->data));
         ENTT_ASSERT(!exists(curr, type->data));
-        curr->identifier = identifier;
+        curr->alias = alias;
         curr->next = type->data;
         type->data = curr;
 
@@ -693,11 +699,11 @@ public:
      * @tparam Setter The actual function to use as a setter.
      * @tparam Getter The actual function to use as a getter.
      * @tparam Policy Optional policy (no policy set by default).
-     * @param identifier Unique identifier.
+     * @param alias Unique identifier.
      * @return An extended meta factory for the parent type.
      */
     template<auto Setter, auto Getter, typename Policy = as_is_t>
-    auto data(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
+    auto data(const ENTT_ID_TYPE alias) ENTT_NOEXCEPT {
         using underlying_type = std::invoke_result_t<decltype(Getter), Type &>;
         static_assert(std::is_invocable_v<decltype(Setter), Type &, underlying_type>);
         auto * const type = internal::meta_info<Type>::resolve();
@@ -714,9 +720,9 @@ public:
             &internal::getter<Type, Getter, Policy>
         };
 
-        ENTT_ASSERT(!exists(identifier, type->data));
+        ENTT_ASSERT(!exists(alias, type->data));
         ENTT_ASSERT(!exists(&node, type->data));
-        node.identifier = identifier;
+        node.alias = alias;
         node.next = type->data;
         type->data = &node;
 
@@ -733,11 +739,11 @@ public:
      *
      * @tparam Candidate The actual function to attach to the meta type.
      * @tparam Policy Optional policy (no policy set by default).
-     * @param identifier Unique identifier.
+     * @param alias Unique identifier.
      * @return An extended meta factory for the parent type.
      */
     template<auto Candidate, typename Policy = as_is_t>
-    auto func(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
+    auto func(const ENTT_ID_TYPE alias) ENTT_NOEXCEPT {
         using helper_type = internal::meta_function_helper_t<decltype(Candidate)>;
         auto * const type = internal::meta_info<Type>::resolve();
 
@@ -756,9 +762,9 @@ public:
             }
         };
 
-        ENTT_ASSERT(!exists(identifier, type->func));
+        ENTT_ASSERT(!exists(alias, type->func));
         ENTT_ASSERT(!exists(&node, type->func));
-        node.identifier = identifier;
+        node.alias = alias;
         node.next = type->func;
         type->func = &node;
 
@@ -805,7 +811,7 @@ public:
         unregister_all(&node->data, &internal::meta_data_node::prop);
         unregister_all(&node->func, &internal::meta_func_node::prop);
 
-        node->identifier = {};
+        node->alias = {};
         node->next = nullptr;
         node->dtor = nullptr;
 
@@ -845,13 +851,13 @@ inline meta_type resolve() ENTT_NOEXCEPT {
 
 
 /**
- * @brief Returns the meta type associated with a given identifier.
- * @param identifier Unique identifier.
- * @return The meta type associated with the given identifier, if any.
+ * @brief Returns the meta type associated with a given alias.
+ * @param alias Unique identifier.
+ * @return The meta type associated with the given alias, if any.
  */
-inline meta_type resolve(const ENTT_ID_TYPE identifier) ENTT_NOEXCEPT {
-    return internal::find_if([identifier](const auto *curr) {
-        return curr->identifier == identifier;
+inline meta_type resolve(const ENTT_ID_TYPE alias) ENTT_NOEXCEPT {
+    return internal::find_if([alias](const auto *curr) {
+        return curr->alias == alias;
     }, *internal::meta_info<>::global);
 }
 

+ 54 - 28
src/entt/meta/meta.hpp

@@ -71,7 +71,7 @@ struct meta_dtor_node {
 
 
 struct meta_data_node {
-    ENTT_ID_TYPE identifier;
+    ENTT_ID_TYPE alias;
     meta_type_node * const parent;
     meta_data_node * next;
     meta_prop_node * prop;
@@ -85,7 +85,7 @@ struct meta_data_node {
 
 struct meta_func_node {
     using size_type = std::size_t;
-    ENTT_ID_TYPE identifier;
+    ENTT_ID_TYPE alias;
     meta_type_node * const parent;
     meta_func_node * next;
     meta_prop_node * prop;
@@ -101,7 +101,7 @@ struct meta_func_node {
 struct meta_type_node {
     using size_type = std::size_t;
     const ENTT_ID_TYPE id;
-    ENTT_ID_TYPE identifier;
+    ENTT_ID_TYPE alias;
     meta_type_node * next;
     meta_prop_node * prop;
     const bool is_void;
@@ -868,9 +868,15 @@ struct meta_data {
         : node{curr}
     {}
 
-    /*! @copydoc meta_type::identifier */
+    /*! @copydoc meta_type::alias */
+    ENTT_ID_TYPE alias() const ENTT_NOEXCEPT {
+        return node->alias;
+    }
+
+    /*! @copydoc alias*/
+    [[deprecated("Use ::alias instead")]]
     ENTT_ID_TYPE identifier() const ENTT_NOEXCEPT {
-        return node->identifier;
+        return alias();
     }
 
     /*! @copydoc meta_base::parent */
@@ -1008,9 +1014,15 @@ struct meta_func {
         : node{curr}
     {}
 
-    /*! @copydoc meta_type::identifier */
+    /*! @copydoc meta_type::alias */
+    ENTT_ID_TYPE alias() const ENTT_NOEXCEPT {
+        return node->alias;
+    }
+
+    /*! @copydoc alias */
+    [[deprecated("Use ::alias instead")]]
     ENTT_ID_TYPE identifier() const ENTT_NOEXCEPT {
-        return node->identifier;
+        return alias();
     }
 
     /*! @copydoc meta_base::parent */
@@ -1132,11 +1144,25 @@ public:
     {}
 
     /**
-     * @brief Returns the identifier assigned to a given meta object.
-     * @return The identifier assigned to the meta object.
+     * @brief Returns the id of the underlying type.
+     * @return The id of the underlying type.
+     */
+    ENTT_ID_TYPE id() const ENTT_NOEXCEPT {
+        return node->id;
+    }
+
+    /**
+     * @brief Returns the alias assigned to a given meta object.
+     * @return The alias assigned to the meta object.
      */
+    ENTT_ID_TYPE alias() const ENTT_NOEXCEPT {
+        return node->alias;
+    }
+
+    /*! @copydoc alias */
+    [[deprecated("Use ::alias instead")]]
     ENTT_ID_TYPE identifier() const ENTT_NOEXCEPT {
-        return node->identifier;
+        return alias();
     }
 
     /**
@@ -1277,13 +1303,13 @@ public:
     }
 
     /**
-     * @brief Returns the meta base associated with a given identifier.
-     * @param identifier Unique identifier.
-     * @return The meta base associated with the given identifier, if any.
+     * @brief Returns the meta base associated with a given alias.
+     * @param alias Unique identifier.
+     * @return The meta base associated with the given alias, if any.
      */
-    meta_base base(const ENTT_ID_TYPE identifier) const {
-        return internal::find_if<&internal::meta_type_node::base>([identifier](const auto *curr) {
-            return curr->type()->identifier == identifier;
+    meta_base base(const ENTT_ID_TYPE alias) const {
+        return internal::find_if<&internal::meta_type_node::base>([alias](const auto *curr) {
+            return curr->type()->alias == alias;
         }, node);
     }
 
@@ -1345,16 +1371,16 @@ public:
     }
 
     /**
-     * @brief Returns the meta data associated with a given identifier.
+     * @brief Returns the meta data associated with a given alias.
      *
      * The meta data of the base classes will also be visited, if any.
      *
-     * @param identifier Unique identifier.
-     * @return The meta data associated with the given identifier, if any.
+     * @param alias Unique identifier.
+     * @return The meta data associated with the given alias, if any.
      */
-    meta_data data(const ENTT_ID_TYPE identifier) const {
-        return internal::find_if<&internal::meta_type_node::data>([identifier](const auto *curr) {
-            return curr->identifier == identifier;
+    meta_data data(const ENTT_ID_TYPE alias) const {
+        return internal::find_if<&internal::meta_type_node::data>([alias](const auto *curr) {
+            return curr->alias == alias;
         }, node);
     }
 
@@ -1373,16 +1399,16 @@ public:
     }
 
     /**
-     * @brief Returns the meta function associated with a given identifier.
+     * @brief Returns the meta function associated with a given alias.
      *
      * The meta functions of the base classes will also be visited, if any.
      *
-     * @param identifier Unique identifier.
-     * @return The meta function associated with the given identifier, if any.
+     * @param alias Unique identifier.
+     * @return The meta function associated with the given alias, if any.
      */
-    meta_func func(const ENTT_ID_TYPE identifier) const {
-        return internal::find_if<&internal::meta_type_node::func>([identifier](const auto *curr) {
-            return curr->identifier == identifier;
+    meta_func func(const ENTT_ID_TYPE alias) const {
+        return internal::find_if<&internal::meta_type_node::func>([alias](const auto *curr) {
+            return curr->alias == alias;
         }, node);
     }
 

+ 33 - 30
test/entt/meta/meta.cpp

@@ -3,6 +3,7 @@
 #include <type_traits>
 #include <gtest/gtest.h>
 #include <entt/core/hashed_string.hpp>
+#include <entt/core/type_info.hpp>
 #include <entt/core/utility.hpp>
 #include <entt/meta/factory.hpp>
 #include <entt/meta/meta.hpp>
@@ -157,7 +158,7 @@ struct Meta: ::testing::Test {
         entt::meta<double>().conv<int>();
 
         entt::meta<char>()
-                .type("char"_hs)
+                .alias("char"_hs)
                     .prop(props::prop_int, 42)
                 .data<&set<char>, &get<char>>("value"_hs);
 
@@ -177,10 +178,10 @@ struct Meta: ::testing::Test {
         entt::meta<unsigned int>().data<0u>("min"_hs).data<100u>("max"_hs);
 
         entt::meta<base_type>()
-                .type("base"_hs);
+                .alias("base"_hs);
 
         entt::meta<derived_type>()
-                .type("derived"_hs)
+                .alias("derived"_hs)
                     .prop(props::prop_int, 99)
                 .base<base_type>()
                 .ctor<const base_type &, int, char>()
@@ -191,16 +192,16 @@ struct Meta: ::testing::Test {
                 .conv<&derived_type::g>();
 
         entt::meta<empty_type>()
-                .type("empty"_hs)
+                .alias("empty"_hs)
                 .dtor<&empty_type::destroy>();
 
         entt::meta<fat_type>()
-                .type("fat"_hs)
+                .alias("fat"_hs)
                 .base<empty_type>()
                 .dtor<&fat_type::destroy>();
 
         entt::meta<data_type>()
-                .type("data"_hs)
+                .alias("data"_hs)
                 .data<&data_type::i, entt::as_alias_t>("i"_hs)
                     .prop(props::prop_int, 0)
                 .data<&data_type::j>("j"_hs)
@@ -213,12 +214,12 @@ struct Meta: ::testing::Test {
                 .data<&data_type::v, entt::as_void_t>("v"_hs);
 
         entt::meta<array_type>()
-                .type("array"_hs)
+                .alias("array"_hs)
                 .data<&array_type::global>("global"_hs)
                 .data<&array_type::local>("local"_hs);
 
         entt::meta<func_type>()
-                .type("func"_hs)
+                .alias("func"_hs)
                 .func<entt::overload<int(const base_type &, int, int)>(&func_type::f)>("f3"_hs)
                 .func<entt::overload<int(int, int)>(&func_type::f)>("f2"_hs)
                     .prop(props::prop_bool, false)
@@ -234,27 +235,27 @@ struct Meta: ::testing::Test {
                 .func<&func_type::a, entt::as_alias_t>("a"_hs);
 
         entt::meta<setter_getter_type>()
-                .type("setter_getter"_hs)
+                .alias("setter_getter"_hs)
                 .data<&setter_getter_type::static_setter, &setter_getter_type::static_getter>("x"_hs)
                 .data<&setter_getter_type::setter, &setter_getter_type::getter>("y"_hs)
                 .data<&setter_getter_type::static_setter, &setter_getter_type::getter>("z"_hs)
                 .data<&setter_getter_type::setter_with_ref, &setter_getter_type::getter_with_ref>("w"_hs);
 
         entt::meta<an_abstract_type>()
-                .type("an_abstract_type"_hs)
+                .alias("an_abstract_type"_hs)
                     .prop(props::prop_bool, false)
                 .data<&an_abstract_type::i>("i"_hs)
                 .func<&an_abstract_type::f>("f"_hs)
                 .func<&an_abstract_type::g>("g"_hs);
 
         entt::meta<another_abstract_type>()
-                .type("another_abstract_type"_hs)
+                .alias("another_abstract_type"_hs)
                     .prop(props::prop_int, 42)
                 .data<&another_abstract_type::j>("j"_hs)
                 .func<&another_abstract_type::h>("h"_hs);
 
         entt::meta<concrete_type>()
-                .type("concrete"_hs)
+                .alias("concrete"_hs)
                 .base<an_abstract_type>()
                 .base<another_abstract_type>()
                 .func<&concrete_type::f>("f"_hs);
@@ -269,12 +270,12 @@ struct Meta: ::testing::Test {
                     .prop(props::prop_value, 3);
 
         entt::meta<derived_type>()
-                .type("my_type"_hs)
+                .alias("my_type"_hs)
                     .prop(props::prop_bool, false)
                 .ctor<>();
 
         entt::meta<another_abstract_type>()
-                .type("your_type"_hs)
+                .alias("your_type"_hs)
                 .data<&another_abstract_type::j>("a_data_member"_hs)
                 .func<&another_abstract_type::h>("a_member_function"_hs);
     }
@@ -1044,7 +1045,7 @@ TEST_F(Meta, MetaData) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("data"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "i"_hs);
+    ASSERT_EQ(data.alias(), "i"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
@@ -1072,7 +1073,7 @@ TEST_F(Meta, MetaDataConst) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("data"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "j"_hs);
+    ASSERT_EQ(data.alias(), "j"_hs);
     ASSERT_TRUE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 1);
@@ -1099,7 +1100,7 @@ TEST_F(Meta, MetaDataStatic) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("data"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "h"_hs);
+    ASSERT_EQ(data.alias(), "h"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_TRUE(data.is_static());
     ASSERT_EQ(data.get({}).cast<int>(), 2);
@@ -1126,7 +1127,7 @@ TEST_F(Meta, MetaDataConstStatic) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("data"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "k"_hs);
+    ASSERT_EQ(data.alias(), "k"_hs);
     ASSERT_TRUE(data.is_const());
     ASSERT_TRUE(data.is_static());
     ASSERT_EQ(data.get({}).cast<int>(), 3);
@@ -1198,7 +1199,7 @@ TEST_F(Meta, MetaDataSetterGetterAsFreeFunctions) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("setter_getter"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "x"_hs);
+    ASSERT_EQ(data.alias(), "x"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
@@ -1213,7 +1214,7 @@ TEST_F(Meta, MetaDataSetterGetterAsMemberFunctions) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("setter_getter"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "y"_hs);
+    ASSERT_EQ(data.alias(), "y"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
@@ -1228,7 +1229,7 @@ TEST_F(Meta, MetaDataSetterGetterWithRefAsMemberFunctions) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("setter_getter"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "w"_hs);
+    ASSERT_EQ(data.alias(), "w"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
@@ -1243,7 +1244,7 @@ TEST_F(Meta, MetaDataSetterGetterMixed) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("setter_getter"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int>());
-    ASSERT_EQ(data.identifier(), "z"_hs);
+    ASSERT_EQ(data.alias(), "z"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_EQ(data.get(instance).cast<int>(), 0);
@@ -1261,7 +1262,7 @@ TEST_F(Meta, MetaDataArrayStatic) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("array"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int[3]>());
-    ASSERT_EQ(data.identifier(), "global"_hs);
+    ASSERT_EQ(data.alias(), "global"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_TRUE(data.is_static());
     ASSERT_TRUE(data.type().is_array());
@@ -1290,7 +1291,7 @@ TEST_F(Meta, MetaDataArray) {
     ASSERT_TRUE(data);
     ASSERT_EQ(data.parent(), entt::resolve("array"_hs));
     ASSERT_EQ(data.type(), entt::resolve<int[3]>());
-    ASSERT_EQ(data.identifier(), "local"_hs);
+    ASSERT_EQ(data.alias(), "local"_hs);
     ASSERT_FALSE(data.is_const());
     ASSERT_FALSE(data.is_static());
     ASSERT_TRUE(data.type().is_array());
@@ -1337,7 +1338,7 @@ TEST_F(Meta, MetaFunc) {
 
     ASSERT_TRUE(func);
     ASSERT_EQ(func.parent(), entt::resolve("func"_hs));
-    ASSERT_EQ(func.identifier(), "f2"_hs);
+    ASSERT_EQ(func.alias(), "f2"_hs);
     ASSERT_EQ(func.size(), 2u);
     ASSERT_FALSE(func.is_const());
     ASSERT_FALSE(func.is_static());
@@ -1375,7 +1376,7 @@ TEST_F(Meta, MetaFuncConst) {
 
     ASSERT_TRUE(func);
     ASSERT_EQ(func.parent(), entt::resolve("func"_hs));
-    ASSERT_EQ(func.identifier(), "f1"_hs);
+    ASSERT_EQ(func.alias(), "f1"_hs);
     ASSERT_EQ(func.size(), 1u);
     ASSERT_TRUE(func.is_const());
     ASSERT_FALSE(func.is_static());
@@ -1411,7 +1412,7 @@ TEST_F(Meta, MetaFuncRetVoid) {
 
     ASSERT_TRUE(func);
     ASSERT_EQ(func.parent(), entt::resolve("func"_hs));
-    ASSERT_EQ(func.identifier(), "g"_hs);
+    ASSERT_EQ(func.alias(), "g"_hs);
     ASSERT_EQ(func.size(), 1u);
     ASSERT_FALSE(func.is_const());
     ASSERT_FALSE(func.is_static());
@@ -1445,7 +1446,7 @@ TEST_F(Meta, MetaFuncStatic) {
 
     ASSERT_TRUE(func);
     ASSERT_EQ(func.parent(), entt::resolve("func"_hs));
-    ASSERT_EQ(func.identifier(), "h"_hs);
+    ASSERT_EQ(func.alias(), "h"_hs);
     ASSERT_EQ(func.size(), 1u);
     ASSERT_FALSE(func.is_const());
     ASSERT_TRUE(func.is_static());
@@ -1480,7 +1481,7 @@ TEST_F(Meta, MetaFuncStaticRetVoid) {
 
     ASSERT_TRUE(func);
     ASSERT_EQ(func.parent(), entt::resolve("func"_hs));
-    ASSERT_EQ(func.identifier(), "k"_hs);
+    ASSERT_EQ(func.alias(), "k"_hs);
     ASSERT_EQ(func.size(), 1u);
     ASSERT_FALSE(func.is_const());
     ASSERT_TRUE(func.is_static());
@@ -1568,7 +1569,8 @@ TEST_F(Meta, MetaType) {
 
     ASSERT_TRUE(type);
     ASSERT_NE(type, entt::meta_type{});
-    ASSERT_EQ(type.identifier(), "derived"_hs);
+    ASSERT_EQ(type.alias(), "derived"_hs);
+    ASSERT_EQ(type.id(), entt::type_info<derived_type>::id());
 
     type.prop([](auto prop) {
         ASSERT_EQ(prop.key(), props::prop_int);
@@ -1766,6 +1768,7 @@ TEST_F(Meta, AbstractClass) {
     auto type = entt::resolve<an_abstract_type>();
     concrete_type instance;
 
+    ASSERT_EQ(type.id(), entt::type_info<an_abstract_type>::id());
     ASSERT_EQ(instance.i, 0);
 
     type.func("f"_hs).invoke(instance, 3);

+ 2 - 2
test/lib/meta/lib.cpp

@@ -12,13 +12,13 @@ ENTT_API void set_up(entt::meta_ctx ctx) {
     entt::meta_ctx::bind(ctx);
 
     entt::meta<position>()
-            .type("position"_hs)
+            .alias("position"_hs)
             .ctor<&create_position>()
             .data<&position::x>("x"_hs)
             .data<&position::y>("y"_hs);
 
     entt::meta<velocity>()
-            .type("velocity"_hs)
+            .alias("velocity"_hs)
             .ctor<>()
             .data<&velocity::dx>("dx"_hs)
             .data<&velocity::dy>("dy"_hs);

+ 2 - 2
test/lib/meta_plugin/plugin.cpp

@@ -10,13 +10,13 @@ position create_position(int x, int y) {
 
 void set_up() {
     entt::meta<position>()
-            .type("position"_hs)
+            .alias("position"_hs)
             .ctor<&create_position>()
             .data<&position::x>("x"_hs)
             .data<&position::y>("y"_hs);
 
     entt::meta<velocity>()
-            .type("velocity"_hs)
+            .alias("velocity"_hs)
             .ctor<>()
             .data<&velocity::dx>("dx"_hs)
             .data<&velocity::dy>("dy"_hs);

+ 2 - 2
test/lib/meta_plugin_std/plugin.cpp

@@ -10,13 +10,13 @@ position create_position(int x, int y) {
 
 void set_up() {
     entt::meta<position>()
-            .type("position"_hs)
+            .alias("position"_hs)
             .ctor<&create_position>()
             .data<&position::x>("x"_hs)
             .data<&position::y>("y"_hs);
 
     entt::meta<velocity>()
-            .type("velocity"_hs)
+            .alias("velocity"_hs)
             .ctor<>()
             .data<&velocity::dx>("dx"_hs)
             .data<&velocity::dy>("dy"_hs);

+ 2 - 2
test/lib/meta_std/lib.cpp

@@ -12,13 +12,13 @@ ENTT_API void set_up(entt::meta_ctx ctx) {
     entt::meta_ctx::bind(ctx);
 
     entt::meta<position>()
-            .type("position"_hs)
+            .alias("position"_hs)
             .ctor<&create_position>()
             .data<&position::x>("x"_hs)
             .data<&position::y>("y"_hs);
 
     entt::meta<velocity>()
-            .type("velocity"_hs)
+            .alias("velocity"_hs)
             .ctor<>()
             .data<&velocity::dx>("dx"_hs)
             .data<&velocity::dy>("dy"_hs);