diff --git a/src/Generator/Passes/GetterSetterToPropertyPass.cs b/src/Generator/Passes/GetterSetterToPropertyPass.cs index 59512074..54c56f68 100644 --- a/src/Generator/Passes/GetterSetterToPropertyPass.cs +++ b/src/Generator/Passes/GetterSetterToPropertyPass.cs @@ -138,7 +138,7 @@ namespace CppSharp.Passes Class @class = (Class) method.Namespace; Property property = @class.Properties.Find( p => p.Field == null && - (p.Name == name || + ((!isSetter && p.HasSetter && p.Name == name) || (isSetter && p.HasGetter && GetReadWritePropertyName(p.GetMethod, name) == name)) && ((p.HasGetter && @@ -189,6 +189,15 @@ namespace CppSharp.Passes continue; } + Property conflict = newProperties.LastOrDefault( + p => p.Name == property.Name && p != property && + p.ExplicitInterfaceImpl == property.ExplicitInterfaceImpl); + if (conflict != null && conflict.GetMethod != null) + { + conflict.GetMethod.GenerationKind = GenerationKind.Generate; + conflict.GetMethod = null; + } + RenameConflictingMethods(@class, property); CombineComments(property); } diff --git a/tests/Common/Common.Tests.cs b/tests/Common/Common.Tests.cs index d0846f26..51ef73f3 100644 --- a/tests/Common/Common.Tests.cs +++ b/tests/Common/Common.Tests.cs @@ -527,6 +527,8 @@ public class CommonTests : GeneratorTestFixture Assert.That(prop.StartWithVerb, Is.EqualTo(25)); prop.StartWithVerb = 5; + + Assert.That(prop.Contains('a'), Is.EqualTo(prop.Contains1("a"))); } using (var prop = new HasOverridenSetter()) { diff --git a/tests/Common/Common.cpp b/tests/Common/Common.cpp index 75a65aa9..f31ba108 100644 --- a/tests/Common/Common.cpp +++ b/tests/Common/Common.cpp @@ -642,6 +642,16 @@ void TestProperties::setStartWithVerb(int value) { } +bool TestProperties::contains(char c) +{ + return true; +} + +bool TestProperties::contains(const char* str) +{ + return true; +} + HasOverridenSetter::HasOverridenSetter() { } diff --git a/tests/Common/Common.h b/tests/Common/Common.h index df2b98be..9f04020b 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -619,6 +619,9 @@ public: int startWithVerb(); void setStartWithVerb(int value); + + bool contains(char c); + bool contains(const char* str); private: int FieldValue; double _refToPrimitiveInSetter;