-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Samples.ConsoleNet6; | ||
|
||
internal class Base | ||
{ | ||
public int BasePropAssigned { get; set; } | ||
public int BasePropCommented { get; set; } | ||
public int BasePropUnassigned { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Samples.ConsoleNet6; | ||
|
||
internal class Derived : Base | ||
{ | ||
public int DerivedPropAssigned { get; set; } | ||
public int DerivedPropCommented { get; set; } | ||
public int DerivedPropUnassigned { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// AssignAll enable | ||
// EXAMPLE 004 - Analyzer should also consider public members from any base types. | ||
namespace Samples.ConsoleNet6; | ||
|
||
public static class Example004_Inheritance | ||
{ | ||
public static void Irrelevant() | ||
{ | ||
// This should give analyzer error: | ||
// Missing member assignments in object initializer for type 'Derived'. Properties: BasePropUnassigned, DerivedPropUnassigned | ||
var foo = new Derived | ||
{ | ||
// Commented assignments after opening brace. | ||
// BasePropCommented = , | ||
// DerivedPropCommented = , | ||
|
||
// Assigned property, OK by analyzer | ||
BasePropAssigned = 1, | ||
DerivedPropAssigned = 1, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters