mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
Take the span type from the array conversion's return type
MatchArrayInitializerFinal selects the operator by its return type, so the block's result type is that return type. The declaring type only happens to be the same one for the two array-to-span operators; Span<T> also declares the conversion to ReadOnlySpan<T>. Assisted-by: Claude:claude-opus-5:Claude Code
This commit is contained in:
@@ -3966,8 +3966,8 @@ namespace ICSharpCode.Decompiler.CSharp
|
||||
var initializer = expr.WithILInstruction(block).WithRR(rr);
|
||||
if (arrayToSpan != null)
|
||||
{
|
||||
var arrayToSpanRR = new ConversionResolveResult(arrayToSpan.DeclaringType, rr, Conversion.ImplicitSpanConversion);
|
||||
initializer = new CastExpression(ConvertType(arrayToSpan.DeclaringType), expr).WithoutILInstruction().WithRR(arrayToSpanRR);
|
||||
var arrayToSpanRR = new ConversionResolveResult(arrayToSpan.ReturnType, rr, Conversion.ImplicitSpanConversion);
|
||||
initializer = new CastExpression(ConvertType(arrayToSpan.ReturnType), expr).WithoutILInstruction().WithRR(arrayToSpanRR);
|
||||
}
|
||||
return initializer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user