@@ -450,6 +450,8 @@ macro_rules! impl_property {
450450 impl $crate:: entity:: property:: Property <$entity> for $property {
451451 type CanonicalValue = $canonical_value;
452452
453+ const NAME : & ' static str = stringify!( $property) ;
454+
453455 fn initialization_kind( ) -> $crate:: entity:: property:: PropertyInitializationKind {
454456 $initialization_kind
455457 }
@@ -726,6 +728,17 @@ macro_rules! impl_derived_property {
726728/// reordering of the component properties. The querying subsystem is able to detect when its multiple
727729/// component properties are equivalent to an indexed multi-property and use that index to perform the
728730/// query.
731+ ///
732+ /// Components must be the underlying property type, not a type alias (see issue #843):
733+ ///
734+ /// ```compile_fail
735+ /// use ixa::{define_entity, define_property, define_multi_property};
736+ /// define_entity!(Person);
737+ /// define_property!(struct Age(u8), Person, default_const = Age(0));
738+ /// define_property!(struct Height(u8), Person, default_const = Height(0));
739+ /// type Years = Age;
740+ /// define_multi_property!((Years, Height), Person);
741+ /// ```
729742#[ macro_export]
730743macro_rules! define_multi_property {
731744 (
@@ -735,6 +748,21 @@ macro_rules! define_multi_property {
735748 $crate:: paste:: paste! {
736749 type [ <$( $dependency) * >] = ( $( $dependency) ,+ ) ;
737750
751+ // Reject type aliases; see issue #843.
752+ $(
753+ const _: ( ) = assert!(
754+ $crate:: entity:: property:: const_str_eq(
755+ stringify!( $dependency) ,
756+ <$dependency as $crate:: entity:: property:: Property <$entity>>:: NAME ,
757+ ) ,
758+ concat!(
759+ "define_multi_property!: `" ,
760+ stringify!( $dependency) ,
761+ "` is a type alias; use the underlying property type (see issue #843)."
762+ ) ,
763+ ) ;
764+ ) +
765+
738766 $crate:: impl_property!(
739767 [ <$( $dependency) * >] ,
740768 $entity,
0 commit comments