Skip to content

Commit

Permalink
Fix issue #1283 (#1855)
Browse files Browse the repository at this point in the history
* Fixes issue #1283

* Add test for issue #1283

* Move test for issue #1283 to CSharp test suite

* Fix typo
  • Loading branch information
angryzor authored Jul 26, 2024
1 parent 3f923b1 commit b658ff3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Generator/Passes/GetterSetterToPropertyPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static Stream GetResourceStream(Assembly assembly)
}

public GetterSetterToPropertyPass()
=> VisitOptions.ResetFlags(VisitFlags.ClassTemplateSpecializations);
=> VisitOptions.ResetFlags(VisitFlags.ClassBases | VisitFlags.ClassTemplateSpecializations);

public override bool VisitClassDecl(Class @class)
{
Expand Down
5 changes: 5 additions & 0 deletions tests/dotnet/CSharp/CSharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,11 @@ int HasConflictWithAbstractProperty::conflictWithProperty()
return 0;
}

int TestOverrideOfPropertyInNamespacedClass::property()
{
return 0;
}

const char* HasVirtualTakesReturnsProblematicTypes::virtualTakesAndReturnsString(const char* c)
{
return c;
Expand Down
13 changes: 13 additions & 0 deletions tests/dotnet/CSharp/CSharp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,19 @@ class DLL_API HasConflictWithAbstractProperty
virtual int getConflictWithProperty() = 0;
};

// https://github.com/mono/CppSharp/issues/1283
namespace NamespaceWithVirtualPropertyClass {
class DLL_API HasOverriddenPropertyInNamespacedClass {
public:
virtual int property() = 0;
};
}

class DLL_API TestOverrideOfPropertyInNamespacedClass : public NamespaceWithVirtualPropertyClass::HasOverriddenPropertyInNamespacedClass {
public:
virtual int property() override;
};

template <typename T>
class lowerCase
{
Expand Down

0 comments on commit b658ff3

Please sign in to comment.