Skip to content

Commit

Permalink
Generate valid C# for classes with dependent fields nested in templat…
Browse files Browse the repository at this point in the history
…es with independent fields

Signed-off-by: Dimitar Dobrev <[email protected]>
  • Loading branch information
ddobrev committed Dec 15, 2021
1 parent f44686b commit 69e766b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Generator/Generators/CSharp/CSharpSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ classTemplate.OriginalNamespace is Class &&
foreach (var specialization in generated.KeepSingleAllPointersSpecialization())
GenerateClassInternals(specialization);

foreach (var group in generated.SelectMany(s => s.Classes).Where(
foreach (var group in specializations.SelectMany(s => s.Classes).Where(
c => !c.IsIncomplete).GroupBy(c => c.Name))
{
var nested = classTemplate.Classes.FirstOrDefault(c => c.Name == group.Key);
Expand Down
5 changes: 5 additions & 0 deletions tests/CSharp/CSharpTemplates.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class IndependentFields : public T1
{
typedef T Type;
public:
class Nested
{
private:
T field;
};
IndependentFields();
IndependentFields(const IndependentFields<T>& other);
IndependentFields(const T& t);
Expand Down

0 comments on commit 69e766b

Please sign in to comment.