Skip to content

Commit

Permalink
Update packages
Browse files Browse the repository at this point in the history
=> release
  • Loading branch information
hugener committed Mar 25, 2024
1 parent 4790e8f commit 03438d8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
64 changes: 32 additions & 32 deletions Source/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeRefactoring.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeRefactoring.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageVersion Include="MSTest.TestFramework" Version="3.2.2" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="PolySharp" Version="1.14.1"/>
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435"/>
<PackageVersion Include="Sundew.Generator.Code" Version="3.1.21" />
<PackageVersion Include="Sundew.Packaging.Publish" Version="10.0.7"/>
<PackageVersion Include="Sundew.Testing.CodeAnalysis" Version="0.3.2" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" />
<PackageVersion Include="Verify.Xunit" Version="23.2.3" />
<PackageVersion Include="Verify" Version="23.2.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7"/>
<PackageVersion Include="xunit" Version="2.7.0" />
</ItemGroup>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeRefactoring.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeRefactoring.Testing.MSTest" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageVersion Include="MSTest.TestFramework" Version="3.2.2" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="PolySharp" Version="1.14.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="Sundew.Generator.Code" Version="3.1.21" />
<PackageVersion Include="Sundew.Packaging.Publish" Version="10.0.8" />
<PackageVersion Include="Sundew.Testing.CodeAnalysis" Version="0.3.2" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" />
<PackageVersion Include="Verify.Xunit" Version="23.5.2" />
<PackageVersion Include="Verify" Version="23.5.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageVersion Include="xunit" Version="2.7.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

namespace Sundew.DiscriminatedUnions.Generator.DeclarationStage;

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Sundew.DiscriminatedUnions.Generator;
using Sundew.DiscriminatedUnions.Generator.Model;
using Sundew.DiscriminatedUnions.Generator.OutputStage;
using Sundew.DiscriminatedUnions.Shared;
Expand All @@ -36,15 +34,15 @@ public static IncrementalValuesProvider<DiscriminatedUnionCaseDeclaration> Setup
{
var owners = FindOwners(caseNamedTypeSymbol).Select(x => (Type: x.GetSourceType(), ReturnType: x.GetFullType(true), HasConflictingName: HasConflictingName(x, caseNamedTypeSymbol))).ToImmutableArray();
var parameters = TryGetParameters(caseNamedTypeSymbol);
if (parameters == null)
if (parameters == default)
{
return null;
return default;
}

return new DiscriminatedUnionCaseDeclaration(caseNamedTypeSymbol.GetFullType(), owners, parameters.ToImmutableArray());
}

return null;
return default;
}

private static bool HasConflictingName(INamedTypeSymbol discriminatedUnionNameTypeSymbol, INamedTypeSymbol caseNamedTypeSymbol)
Expand All @@ -55,27 +53,29 @@ private static bool HasConflictingName(INamedTypeSymbol discriminatedUnionNameTy

private static IEnumerable<Parameter>? TryGetParameters(INamedTypeSymbol namedTypeSymbol)
{
var selectedConstructor = namedTypeSymbol.Constructors.SkipWhile(x =>
var selectedConstructor = namedTypeSymbol.Constructors
.OrderByDescending(x => x.Parameters.Length)
.SkipWhile(x =>
x.ContainingType.IsRecord &&
SymbolEqualityComparer.Default.Equals(x.Parameters.FirstOrDefault()?.Type, x.ContainingType))
.FirstOrDefault();
if (selectedConstructor == null)
if (selectedConstructor == default)
{
return null;
return default;
}

return selectedConstructor.Parameters.Select(x =>
{
var typeName = x.Type.ToDisplayString(CodeAnalysisHelper.FullyQualifiedParameterTypeFormat);
var defaultValue = x.HasExplicitDefaultValue ? x.ExplicitDefaultValue?.ToString() ?? GeneratorConstants.Null : null;
var defaultValue = x.HasExplicitDefaultValue ? x.ExplicitDefaultValue?.ToString() ?? GeneratorConstants.Null : default;
return new Parameter(typeName, x.Name.Uncapitalize().AvoidKeywordCollision(), defaultValue);
});
}

private static IEnumerable<INamedTypeSymbol> FindOwners(ITypeSymbol typeSymbol)
{
var baseType = typeSymbol.BaseType;
while (baseType != null)
while (baseType != default)
{
if (baseType.IsDiscriminatedUnion())
{
Expand All @@ -95,7 +95,7 @@ private static bool IsDiscriminatedUnionCaseCandidate(SyntaxNode syntaxNode)
{
static bool HasBaseListAndIsNotAbstract(TypeDeclarationSyntax typeDeclarationSyntax)
{
return typeDeclarationSyntax.BaseList != null && typeDeclarationSyntax.Modifiers.Any(SyntaxKind.SealedKeyword);
return typeDeclarationSyntax.BaseList != default && typeDeclarationSyntax.Modifiers.Any(SyntaxKind.SealedKeyword);
}

return syntaxNode switch
Expand Down

0 comments on commit 03438d8

Please sign in to comment.