Repository navigation
Fix constructor headers without arguments - #839
Merged
Merged
Conversation
The Python, C# and TypeScript constructors checked for no arguments and for one argument in two separate ``if``'s, so a constructor without arguments got two headers. For example, Python rendered both ``def __init__(self) -> None:`` and ``def __init__(\n self\n) -> None:`` when the constructor only called the parent constructor. We now use ``elif len(arg_codes) == 1:``. In C# and TypeScript the branch is not reachable at the moment, as the constructors without arguments have no inlined statements, and are not generated at all. We fix them nevertheless for consistency. We test it with ``Plain_marker``, which only calls ``Marker.__init__``, in the ``deep_class_hierarchy`` meta-model, and add its JSON and XML examples for the live tests.
Coverage Report for CI Build 37160735322Coverage increased (+0.004%) to 90.139%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Python, C# and TypeScript constructors checked for no arguments and for one argument in two separate
if's, so a constructor without arguments got two headers. For example, Python rendered bothdef __init__(self) -> None:anddef __init__(\n self\n) -> None:when the constructor only called the parent constructor. We now useelif len(arg_codes) == 1:.In C# and TypeScript the branch is not reachable at the moment, as the constructors without arguments have no inlined statements, and are not generated at all. We fix them nevertheless for consistency.
We test it with
Plain_marker, which only callsMarker.__init__, in thedeep_class_hierarchymeta-model, and add its JSON and XML examples for the live tests.