Skip to content

Commit

Permalink
fix compile property from trait and constructor parameter property
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmisek committed Feb 23, 2025
1 parent ad88b1b commit b4abb22
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Peachpie.CodeAnalysis/Symbols/Source/SourceTypeSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Globalization;
using System.Threading;
using Microsoft.CodeAnalysis.Text;
using static Pchp.CodeAnalysis.AstUtils;
using Pchp.CodeAnalysis.Utilities;
using Pchp.CodeAnalysis.Errors;
using System.IO;
Expand Down Expand Up @@ -1453,17 +1452,20 @@ public IEnumerable<Symbol> TraitMembers
{
if (s is SynthesizedFieldSymbol fld)
{
if (fieldsset == null) fieldsset = new HashSet<string>();
if (fieldsset == null)
{
fieldsset = new HashSet<string>();
}

if (fieldsset.Add(fld.Name) == false)
{
// field already declared
return false;
}

if (this.Syntax.Members.OfType<FieldDeclList>().SelectMany(list => list.Fields).Select(fdecl => fdecl.Name.Value).Contains(fld.Name))
var members = EnsureMembers(); // get symbols declared in this type, without traits
if (members.Any(m => m is IFieldSymbol f && f.Name == fld.Name))
{
// field already declared by containing class
return false;
}
}
Expand Down

0 comments on commit b4abb22

Please sign in to comment.