Skip to content

Commit

Permalink
Additional test case for generic type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt-kolbay-sonarsource committed Apr 30, 2024
1 parent 50f3424 commit 7416788
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ public class Model<T> where T : Person

public abstract class Person
{
public int Age { get; set; } // Noncompliant
public int Age { get; set; } // Noncompliant
}

public class Developer : Person
{
public string ProgramingLanguage { get; set; }
public int WorkExperienceInYears { get; set; } // Noncompliant
}
}

Expand All @@ -194,7 +195,7 @@ public void Create(MyModel model)
public class Model<T> where T : Model<T>
{
public Model<T> SubModel { get; set; }
public int ValueProperty { get; set; } // Noncompliant
public int ValueProperty { get; set; } // Noncompliant
}

public class MyModel : Model<MyModel>
Expand Down

0 comments on commit 7416788

Please sign in to comment.