Skip to content

Commit

Permalink
upgrade Signum.Analyzer to 2.0 with nullability temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
olmobrutall committed Apr 7, 2019
1 parent 5c1200c commit 2cbf5c9
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
9 changes: 9 additions & 0 deletions Signum.Analyzer/Signum.Analyzer.Test/ExpressionFieldTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ public void ExpressionExplicitCorrect()
public static int OperationLogs(this Entity e) => 0;", includeExpression: true);
}

[TestMethod]
public void ExpressionExplicitCorrectNullable()
{
TestDiagnostic(null, @"
static Expression<Func<Entity, string?>> MyExpression;
[ExpressionField(""MyExpression"")]
public static string? OperationLogs(this Entity e) => """";", includeExpression: true);
}


private void TestDiagnostic(string expectedError, string code, bool includeExpression = false, bool staticClass = true, bool assertErrors = true)
{
Expand Down
2 changes: 1 addition & 1 deletion Signum.Analyzer/Signum.Analyzer.Test/LiteEqualiyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
[TestMethod]
public void CompareLiteAndEntity()
{
TestDiagnostic("Impossible to compare Lite<T> and T. Consider using RefersTo method", @"
TestDiagnostic("Impossible to compare Lite<T> and T. Consider using 'Is' extension method", @"
Lite<Entity> lite = null;
Entity entity = null;
var condition = lite == entity;
Expand Down
3 changes: 2 additions & 1 deletion Signum.Analyzer/Signum.Analyzer/ExpressionFieldAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static void AnalyzeAttributeSymbol(SyntaxNodeAnalysisContext context)

if (!expressionType.Equals(fieldSymbol.Type))
{
//if (!expressionType.ToString().Equals(fieldSymbol.Type.ToString())) // Till there is an API to express nullability
if (!expressionType.ToString().Replace("?", "").Equals(
fieldSymbol.Type.ToString().Replace("?", ""))) // Till there is an API to express nullability
{
var minimalParts = expressionType.ToMinimalDisplayString(context.SemanticModel, member.GetLocation().SourceSpan.Start);
Diagnostic(context, ident, att.GetLocation(), string.Format("type of '{0}' should be '{1}'", fieldName, minimalParts));
Expand Down
7 changes: 4 additions & 3 deletions Signum.Analyzer/Signum.Analyzer/Signum.Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<PropertyGroup>
<PackageId>Signum.Analyzer</PackageId>
<PackageVersion>2.0.0-beta</PackageVersion>
<PackageVersion>2.0.0</PackageVersion>
<Authors>Olmo del Corral</Authors>
<PackageProjectUrl>http://www.signumframework.com</PackageProjectUrl>
<RepositoryUrl>https://github.com/signumsoftware/framework</RepositoryUrl>
Expand All @@ -17,9 +17,10 @@
<Copyright></Copyright>
<PackageTags>Signum.Analyzer, analyzers</PackageTags>
<NoPackageAnalysis>true</NoPackageAnalysis>
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
<Version>2.0.0-beta</Version>
<PackageLicenseUrl></PackageLicenseUrl>
<Version>2.0.0</Version>
<PackageIconUrl>https://raw.githubusercontent.com/signumsoftware/framework/master/SignumLogo.png</PackageIconUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Signum.Engine/Signum.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Signum.Analyzer" Version="1.0.1" />
<PackageReference Include="Signum.Analyzer" Version="2.0.0" />
<PackageReference Include="Signum.MSBuildTask" Version="1.0.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Signum.Entities/Signum.Entities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Signum.Analyzer" Version="1.0.1" />
<PackageReference Include="Signum.Analyzer" Version="2.0.0" />
<PackageReference Include="Signum.MSBuildTask" Version="1.0.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Signum.React/Signum.React.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Signum.Analyzer" Version="1.0.1" />
<PackageReference Include="Signum.Analyzer" Version="2.0.0" />
<PackageReference Include="Signum.TSGenerator" Version="2.0.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Signum.Test/Signum.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="Signum.Analyzer" Version="1.0.1" />
<PackageReference Include="Signum.Analyzer" Version="2.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand Down

1 comment on commit 2cbf5c9

@olmobrutall
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix Signum.Analyzer

Please update to Signum.Analyzer 2.0 to fix a bugrelated to type comparison on ExpressionFieldAnalyzer

Please sign in to comment.