Skip to content

Commit

Permalink
Fix icsharpcode#2712: TransformCollectionAndObjectInitializers fails …
Browse files Browse the repository at this point in the history
…to properly detect set-accessors of FakeProperties.

Bug likely introduced due to an oversight in icsharpcode#2677.
  • Loading branch information
siegfriedpammer authored and Charlie Lin committed Jun 19, 2022
1 parent 2644215 commit cffa714
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,8 @@ public static (AccessPathKind Kind, List<AccessPathElement> Path, List<ILInstruc
var property = method.AccessorOwner as IProperty;
if (!CanBeUsedInInitializer(property, resolveContext, kind, path))
goto default;
var isGetter = method.Equals(property?.Getter);
var indices = call.Arguments.Skip(1).Take(call.Arguments.Count - (isGetter ? 1 : 2))
.ToArray();
var isGetter = method.AccessorKind == System.Reflection.MethodSemanticsAttributes.Getter;
var indices = call.Arguments.Skip(1).Take(call.Arguments.Count - (isGetter ? 1 : 2)).ToArray();
if (indices.Length > 0 && settings?.DictionaryInitializers == false)
goto default;
if (possibleIndexVariables != null)
Expand Down

0 comments on commit cffa714

Please sign in to comment.