Skip to content

Commit b658ff3

Browse files
authored
Fix issue #1283 (#1855)
* Fixes issue #1283 * Add test for issue #1283 * Move test for issue #1283 to CSharp test suite * Fix typo
1 parent 3f923b1 commit b658ff3

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/Generator/Passes/GetterSetterToPropertyPass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static Stream GetResourceStream(Assembly assembly)
4040
}
4141

4242
public GetterSetterToPropertyPass()
43-
=> VisitOptions.ResetFlags(VisitFlags.ClassTemplateSpecializations);
43+
=> VisitOptions.ResetFlags(VisitFlags.ClassBases | VisitFlags.ClassTemplateSpecializations);
4444

4545
public override bool VisitClassDecl(Class @class)
4646
{

tests/dotnet/CSharp/CSharp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,11 @@ int HasConflictWithAbstractProperty::conflictWithProperty()
12821282
return 0;
12831283
}
12841284

1285+
int TestOverrideOfPropertyInNamespacedClass::property()
1286+
{
1287+
return 0;
1288+
}
1289+
12851290
const char* HasVirtualTakesReturnsProblematicTypes::virtualTakesAndReturnsString(const char* c)
12861291
{
12871292
return c;

tests/dotnet/CSharp/CSharp.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,19 @@ class DLL_API HasConflictWithAbstractProperty
10291029
virtual int getConflictWithProperty() = 0;
10301030
};
10311031

1032+
// https://github.com/mono/CppSharp/issues/1283
1033+
namespace NamespaceWithVirtualPropertyClass {
1034+
class DLL_API HasOverriddenPropertyInNamespacedClass {
1035+
public:
1036+
virtual int property() = 0;
1037+
};
1038+
}
1039+
1040+
class DLL_API TestOverrideOfPropertyInNamespacedClass : public NamespaceWithVirtualPropertyClass::HasOverriddenPropertyInNamespacedClass {
1041+
public:
1042+
virtual int property() override;
1043+
};
1044+
10321045
template <typename T>
10331046
class lowerCase
10341047
{

0 commit comments

Comments
 (0)