Skip to content

Parsing of python type annotations for member variables vs. static/class variables #10670

@PlasmaHH

Description

@PlasmaHH

Describe the bug
Consider the following code:

class Frobble:
    def __init__(self):
        self._x = "42"
    _x : int

This will create a class when instantiated having a member _x but no static attribute (that is, Frobble._x does not exist). Only when you assign something to the class attribute it will start existing. (Also note that type checkers like mypy would flag as an error the assigment of a str to a variable declared as int )

doxygen however documents the above code as both having an untype member _x and a static protected attribute _x of type int.

I would expect that doxygen (because nothing was assigned to the class level _x ) document only the member, and that as type int.

(btw. I noticed that when you do self._x: int = 42 doxygen doesn't document that member at all )

Doxygen version 1.10.0 on opensuse tumbleweed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions