You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Binding codevoid_ZN12chimera_test4math6VectorILin1EEE(::pybind11::module& m) {
auto sm = m.def_submodule("math");
auto attr = sm;
::pybind11::class_<chimera_test::math::Vector<common::Dynamic> >(attr, "VectorX") // 'common::Dynamic' is expected to be 'chimera_test::common::Dynamic'
.def(::pybind11::init<>());
}
The template argument of Vector, Dynamic, is not fully qualified.
Expected: chimera_test::math::Vector<chimera_test::common::Dynamic> or chimera_test::math::Vector<-1> (after evaluated)
However, non-type template arguments not handled by this function, as documented in the code (line: 266-268).
Simple Workaround
For this particular case, we can work around by putting using namespace chimera_test; to the configuration YAML in the template section accordingly. But I'm not sure if this could be problematic in other situations.
Once we get the expression in string, we might be able to get the fully qualified type by using chimera::util::resolveType() and cling::utils::GetFullyQualifiedType(). Then we could overwrite the type by expr->setType(fully_qualified_type).
This approach requires to change the code dependencies so that we can call chimera::util::resolveType() in cling_utils_AST.cpp. I haven't tested this approach yet for this limitation.
Overwriting Output of Fully-Qualified Type Name
This would be a more hacky version than the previous one. We could modify cling::utils::GetFullyQualifiedType() to return which template arguments are still needed to be fully-qualified, and update them afterward. This is because we don't have control over clang::QualType::getAsString().
The text was updated successfully, but these errors were encountered:
Current Behavior
The template argument of
Vector
,Dynamic
, is not fully qualified.chimera_test::math::Vector<chimera_test::common::Dynamic>
orchimera_test::math::Vector<-1>
(after evaluated)chimera_test::math::Vector<common::Dynamic>
Reasoning
Type template arguments are converted to fully qualified type name here:
chimera/external/cling/src/cling_utils_AST.cpp
Lines 261 to 300 in a9b6132
However, non-type template arguments not handled by this function, as documented in the code (line: 266-268).
Simple Workaround
For this particular case, we can work around by putting
using namespace chimera_test;
to the configuration YAML in the template section accordingly. But I'm not sure if this could be problematic in other situations.Possible Approaches
Overwriting Type of Expression
We could print the expression by:
Once we get the expression in string, we might be able to get the fully qualified type by using
chimera::util::resolveType()
andcling::utils::GetFullyQualifiedType()
. Then we could overwrite the type byexpr->setType(fully_qualified_type)
.This approach requires to change the code dependencies so that we can call
chimera::util::resolveType()
incling_utils_AST.cpp
. I haven't tested this approach yet for this limitation.Overwriting Output of Fully-Qualified Type Name
This would be a more hacky version than the previous one. We could modify
cling::utils::GetFullyQualifiedType()
to return which template arguments are still needed to be fully-qualified, and update them afterward. This is because we don't have control overclang::QualType::getAsString()
.The text was updated successfully, but these errors were encountered: