Skip to content

Commit

Permalink
adjustment for properties that don't match on type, or are forced as …
Browse files Browse the repository at this point in the history
…new (#473)
  • Loading branch information
dpvreony authored Jan 18, 2025
1 parent c44e665 commit eb506a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Vetuviem.Avalonia.SourceGenerator\Vetuviem.Avalonia.SourceGenerator.csproj" OutputItemType="Analyzer" />
<ProjectReference Include="..\Vetuviem.Avalonia.SourceGenerator\Vetuviem.Avalonia.SourceGenerator.csproj" OutputItemType="Analyzer" PrivateAssets="all" ReferenceOutputAssembly="false" Private="false" />
<ProjectReference Include="..\Vetuviem.Core\Vetuviem.Core.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,22 @@ private static bool ReplacesBaseProperty(
while (baseType != null)
{
var nameMatches = baseType.GetMembers()
.Where(x => x.Kind == SymbolKind.Property && x.Name.Equals(wantedName, StringComparison.Ordinal))
.Where(x => x.Kind == SymbolKind.Property && x.Name.Equals(wantedName, StringComparison.Ordinal) && x.DeclaredAccessibility == Accessibility.Public)
.Cast<IPropertySymbol>()
.ToImmutableArray();

foreach (var nameMatch in nameMatches)
if (nameMatches.Length > 0)
{
if (SymbolEqualityComparer.Default.Equals(nameMatch.Type, propertySymbol.Type))
foreach (var nameMatch in nameMatches)
{
return !propertySymbol.IsOverride;
if (SymbolEqualityComparer.Default.Equals(nameMatch.Type, propertySymbol.Type))
{
return !propertySymbol.IsOverride;
}
}

// we didn't match by type, so assume it's a new implementation on a new type.
return true;
}

baseType = baseType.BaseType;
Expand Down

0 comments on commit eb506a9

Please sign in to comment.