Skip to content

Commit

Permalink
S3253: Add FP Repro for #8436 (#8454)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-paidis-sonarsource committed Dec 8, 2023
1 parent 1e69a74 commit b36349a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Expand Up @@ -47,3 +47,17 @@ record FooWithParams(string name)

~FooWithParams() { } // Fixed
}

// https://github.com/SonarSource/sonar-dotnet/issues/8436
public class Repro_FP_8436
{
public abstract record BaseRecord(string Value);

public record RecordStyle() : BaseRecord("SomeValue"); // Fixed

public record DefaultStyle : BaseRecord
{
public DefaultStyle() : base("SomeValue") // Compliant, "default" way of calling Base constructor
{ }
}
}
Expand Up @@ -48,3 +48,17 @@ record FooWithParams(string name)

~FooWithParams() { } // Noncompliant {{Remove this redundant destructor.}}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8436
public class Repro_FP_8436
{
public abstract record BaseRecord(string Value);

public record RecordStyle() : BaseRecord("SomeValue"); // Noncompliant FP, Foo is calling Base constructor with record idiomatic syntax, it's not redundant

public record DefaultStyle : BaseRecord
{
public DefaultStyle() : base("SomeValue") // Compliant, "default" way of calling Base constructor
{ }
}
}

0 comments on commit b36349a

Please sign in to comment.