Skip to content

Commit 09b2935

Browse files
committed
Merge branch 'cli-fix-rename-toplevel'
# Conflicts: # ChangeLog.md
2 parents 119ee9c + a75eb9b commit 09b2935

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
- Fix analyzer [RCS1172](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1172) ([PR](https://github.com/dotnet/roslynator/pull/1710))
1919
- [CLI] Fix `loc` command ([PR](https://github.com/dotnet/roslynator/pull/1711))
20+
- Exclude ref-field backed properties from [RCS1085](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1085) ([PR](https://github.com/dotnet/roslynator/pull/1718) by @ovska)
2021
- [CLI] Fix `rename-symbol` support for top-level statement ([PR](https://github.com/dotnet/roslynator/pull/1721))
2122

2223
## [4.14.1] - 2025-10-05

src/Analyzers/CSharp/Analysis/UseAutoPropertyAnalyzer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ private static void AnalyzePropertyDeclaration(SyntaxNodeAnalysisContext context
108108
return;
109109
}
110110

111+
#if ROSLYN_4_4
112+
if (fieldSymbol.RefKind is RefKind.Ref or RefKind.RefReadOnly)
113+
return;
114+
#endif
115+
111116
if (!CheckPreprocessorDirectives(property))
112117
return;
113118

src/Tests/Analyzers.Tests/RCS1085UseAutoPropertyTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,4 +981,30 @@ private static void Write2(ref readonly ReadOnlySequence<byte> data, IBufferWrit
981981
}
982982
}");
983983
}
984+
985+
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UseAutoProperty)]
986+
public async Task TestNoDiagnostic_BackingFieldRef()
987+
{
988+
await VerifyNoDiagnosticAsync(
989+
@"
990+
public ref struct Example(ref int value1, ref int value2)
991+
{
992+
private ref int _value1 = ref value1;
993+
private readonly ref int _value2 = ref value2;
994+
995+
public int Value1
996+
{
997+
get => _value1;
998+
set => _value1 = value;
999+
}
1000+
1001+
public int Value2
1002+
{
1003+
get => _value2;
1004+
set => _value2 = value;
1005+
}
1006+
}
1007+
"
1008+
);
1009+
}
9841010
}

src/Workspaces.Core/Rename/SymbolListHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static List<ISymbol> SortAndFilterMemberSymbols(IEnumerable<ISymbol> symb
9393
results.Add(symbol);
9494

9595
results.AddRange(methodSymbol.TypeParameters);
96-
results.AddRange(methodSymbol.Parameters.Where(ms => !ms.IsImplicitlyDeclared));
96+
results.AddRange(methodSymbol.Parameters.Where(p => !p.IsImplicitlyDeclared));
9797
}
9898
else
9999
{

0 commit comments

Comments
 (0)