mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Update NuGet packages
This commit is contained in:
@@ -29,12 +29,14 @@ public class ParameterMustHaveValidConverterAnalyzer : AnalyzerBase
|
||||
if (parameter.ConverterType is null)
|
||||
return;
|
||||
|
||||
var converterValueType = parameter.ConverterType
|
||||
var converterValueType = parameter
|
||||
.ConverterType
|
||||
.GetBaseTypes()
|
||||
.FirstOrDefault(
|
||||
t => t.ConstructedFrom.DisplayNameMatches(SymbolNames.CliFxBindingConverterClass)
|
||||
)
|
||||
?.TypeArguments.FirstOrDefault();
|
||||
?.TypeArguments
|
||||
.FirstOrDefault();
|
||||
|
||||
// Value returned by the converter must be assignable to the property type
|
||||
var isCompatible =
|
||||
@@ -45,10 +47,9 @@ public class ParameterMustHaveValidConverterAnalyzer : AnalyzerBase
|
||||
? context.Compilation.IsAssignable(converterValueType, property.Type)
|
||||
// Non-scalar (assume we can handle all IEnumerable types for simplicity)
|
||||
: property.Type.TryGetEnumerableUnderlyingType() is { } enumerableUnderlyingType
|
||||
&& context.Compilation.IsAssignable(
|
||||
converterValueType,
|
||||
enumerableUnderlyingType
|
||||
)
|
||||
&& context
|
||||
.Compilation
|
||||
.IsAssignable(converterValueType, enumerableUnderlyingType)
|
||||
);
|
||||
|
||||
if (!isCompatible)
|
||||
|
||||
Reference in New Issue
Block a user