-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: breathe AssertionError during build #100
Comments
The issue here is that both sphinx-immaterial and breathe are doing their own munging of the Sphinx C++ domain output. The munging by sphinx-immaterial happens first, and then breathe does not find the expected structure. The actual error you are seeing is triggered by this line: Sphinx-immaterial wraps template parameters in a The following patch disables the use of diff --git a/sphinx_immaterial/cpp_domain_fixes.py b/sphinx_immaterial/cpp_domain_fixes.py
index 59a34fa..7fd17d8 100644
--- a/sphinx_immaterial/cpp_domain_fixes.py
+++ b/sphinx_immaterial/cpp_domain_fixes.py
@@ -148,18 +148,19 @@ def _monkey_patch_cpp_ast_template_params():
lineSpec: bool,
) -> None:
fake_parent = sphinx.addnodes.desc_signature("", "")
- signode = desc_cpp_template_params("", "")
- parentNode += signode
+ #signode = desc_cpp_template_params("", "")
+ #parentNode += signode
+ signode = parentNode
orig_describe_signature_as_introducer(
self, signode, mode, env, symbol, lineSpec
)
# Ensure the requires clause is not wrapped in
# `desc_cpp_template_params`.
- if signode.children:
- last_child = signode.children[-1]
- if isinstance(last_child, desc_cpp_requires_clause):
- del signode.children[-1]
- parentNode += last_child
+ #if signode.children:
+ # last_child = signode.children[-1]
+ # if isinstance(last_child, desc_cpp_requires_clause):
+ # del signode.children[-1]
+ # parentNode += last_child
for x in signode.traverse(condition=sphinx.addnodes.desc_name):
# Ensure template parameter names aren't styled as the main entity
# name. However, I'm not sure how to best deal with this issue in general. |
Could we make |
Currently we don't actually rely on The specific way it is used is that the autosummary extension abbreviates template parameters as follows: Let's say we have: template <typename T>
class Foo {
template <typename U>
void bar(U u);
template <typename X>
class Baz;
}; On the page that documents template <typename T>
class Foo; and void bar(U u);
class Baz<X>; Note: Template parameters are excluded from function templates, but for class templates the template arguments are added in. On the individual pages documenting template <typename U>
void Foo<T>::bar(U u);
template <typename X>
class Foo<T>::Baz; Note: Only template parameters for the final entity being documented are shown, any template parameters of the surrounding scope are elided, and just shown more compactly as template arguments We can't just feed in these elided declarations to the Sphinx C++ domain, though, because then it would not properly associated the template parameters with the template arguments, and produce the wrong symbol and possibly emit warnings/errors. Instead, we feed the Sphinx C++ domain the full declaration with all template parameters, and then post-process the resulting docutils nodes to remove the template parameters that we want to exclude.. Currently that code makes use of the I think the simplest solution is to just remove |
It would be best if we support your custom C++ autosummary as well as breathe (though I can't imagine them used simultaneously). This will have to wait till #92 is being addressed. |
Yeah, I think it will be possible to support both, it will just be necessary to use a different mechanism to "tag" the template parameters, e.g. by setting an additional attribute on the |
Fixes #100. For the C++ autosummary extension, a different mechanism will need to be used to identify the template parameters.
Fixes #100. For the C++ autosummary extension, a different mechanism will need to be used to identify the template parameters.
Hi,
I've been testing this out on my project and was keen to try out the recent C++ improvements.
Unfortunately, since version 0.5.0 I'm getting the following assertion failure during a build:
The full log is here (using version 0.7.2): https://gist.github.com/reupen/52848dcd31c6266ab5fcb3c469dd85fb
Rough repro steps (Windows):
The last version with a successful build was 0.4.1.
Thanks
The text was updated successfully, but these errors were encountered: