Skip to content

Commit 4011304

Browse files
committed
fix #29 ignore intefrace overrided properties
1 parent f12e876 commit 4011304

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

AutoInterfaceSample/Program.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ public static void Main()
1313
}
1414
}
1515

16-
public interface IB
16+
interface IA
1717
{
18-
protected Point Point { get; }
19-
int X() => Point.X;
20-
int Y => Point.Y;
18+
int X();
19+
int Y { get; }
20+
}
21+
22+
interface IB : IA
23+
{
24+
Point Point { get; }
25+
int IA.X() => Point.X;
26+
int IA.Y => Point.Y;
2127
static int Count => 1;
2228
int Count2 => 2;
2329
}
@@ -29,6 +35,19 @@ partial class C1 : IB
2935
System.Drawing.Point IB.Point => Point.Empty;
3036
}
3137

38+
partial class C2 : IB
39+
{
40+
[AutoInterface(typeof(IB))] private IB _inner = default!;
41+
42+
}
43+
44+
partial class D1 : IB
45+
{
46+
47+
[AutoInterface(typeof(IB), IncludeBaseInterfaces = true)] private IB _inner = default!;
48+
49+
}
50+
3251
public class MyDb : IDb
3352
{
3453
[AllowNull]

BeaKona.AutoInterfaceGenerator/AutoInterfaceSourceGenerator.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,11 @@ bool ShouldGenerate(ISymbol member)
697697
}
698698
}
699699

700+
if (member is IPropertySymbol p && p.ExplicitInterfaceImplementations.Length > 0)
701+
{
702+
return false;
703+
}
704+
700705
var memberImplementedBySignature = type.IsMemberImplementedBySignature(member, true);
701706
var memberImplementedExplicitly = type.IsMemberImplementedExplicitly(member);
702707

0 commit comments

Comments
 (0)