@@ -334,16 +334,16 @@ struct CastInfo<
334334 std::is_base_of_v<mlir::Type, From>>>
335335 : NullableValueCastFailed<To>,
336336 DefaultDoCastIfPossible<To, From, CastInfo<To, From>> {
337- // / Arguments are taken as mlir::Type here and not as From.
338- // / Because when casting from an intermediate type of the hierarchy to one of
339- // / its children, the val.getTypeID() inside T::classof will use the static
340- // / getTypeID of the parent instead of the non-static Type::getTypeID return
341- // / the dynamic ID. so T::classof would end up comparing the static TypeID of
342- // / The children to the static TypeID of its parent making it impossible to
343- // / downcast from the parent to the child
337+ // / Arguments are taken as mlir::Type here and not as ` From`, because when
338+ // / casting from an intermediate type of the hierarchy to one of its children,
339+ // / the val.getTypeID() inside T::classof will use the static getTypeID of the
340+ // / parent instead of the non-static Type::getTypeID that returns the dynamic
341+ // / ID. This means that T::classof would end up comparing the static TypeID of
342+ // / the children to the static TypeID of its parent, making it impossible to
343+ // / downcast from the parent to the child.
344344 static inline bool isPossible (mlir::Type ty) {
345345 // / Return a constant true instead of a dynamic true when casting to self or
346- // / up the hierarchy
346+ // / up the hierarchy.
347347 return std::is_same_v<To, std::remove_const_t <From>> ||
348348 std::is_base_of_v<To, From> || To::classof (ty);
349349 }
0 commit comments