You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1473,13 +1472,13 @@ public Task RecursiveMethod_DiagnosticAsync()
1473
1472
public class Test
1474
1473
{
1475
1474
public void [|Recursive|](string argument)
1476
-
{
1477
-
if (argument.Length > 1)
1478
-
{
1475
+
{
1476
+
if (argument.Length > 1)
1477
+
{
1479
1478
Recursive(argument[1..]);
1480
-
}
1479
+
}
1481
1480
1482
-
Console.WriteLine($""argument[-1]: {argument}"");
1481
+
Console.WriteLine($""argument[-1]: {argument}"");
1483
1482
}
1484
1483
}",
1485
1484
FixedCode=@"
@@ -1488,17 +1487,47 @@ public class Test
1488
1487
public class Test
1489
1488
{
1490
1489
public static void Recursive(string argument)
1491
-
{
1492
-
if (argument.Length > 1)
1493
-
{
1490
+
{
1491
+
if (argument.Length > 1)
1492
+
{
1494
1493
Recursive(argument[1..]);
1495
-
}
1494
+
}
1496
1495
1497
-
Console.WriteLine($""argument[-1]: {argument}"");
1496
+
Console.WriteLine($""argument[-1]: {argument}"");
1498
1497
}
1499
1498
}",
1500
1499
LanguageVersion=LanguageVersion.CSharp8
1501
1500
}.RunAsync();
1502
1501
}
1502
+
1503
+
[Fact(Skip="Need update of roslyn to parse primary constructors properly"),WorkItem(6573,"https://github.com/dotnet/roslyn-analyzers/issues/6573")]
1504
+
publicTaskPrimaryConstructor()
1505
+
{
1506
+
returnnewVerifyCS.Test
1507
+
{
1508
+
TestCode="""
1509
+
using System;
1510
+
using System.Collections.Generic;
1511
+
using System.Linq;
1512
+
1513
+
public class Student(int id, string name, IEnumerable<decimal> grades)
1514
+
{
1515
+
public Student(int id, string name) : this(id, name, new List<decimal>()) { }
1516
+
public int Id => id;
1517
+
public string Name { get; set; } = name.Trim();
1518
+
1519
+
// validate property
1520
+
public decimal GPA => grades.Any() ? grades.Average() : 4.0m;
1521
+
1522
+
// validate method
1523
+
public decimal GetGPA() => grades.Any() ? grades.Average() : 4.0m;
0 commit comments