Files
2026-08-27 10:56:38 -06:00

36 lines
1.3 KiB
C#

using Microsoft.CodeAnalysis.CSharp.Symbols;
namespace Microsoft.CodeAnalysis.CSharp;
internal sealed class LazyArrayElementCantBeRefAnyDiagnosticInfo : LazyDiagnosticInfo
{
private readonly TypeWithAnnotations _possiblyRestrictedTypeSymbol;
internal LazyArrayElementCantBeRefAnyDiagnosticInfo(TypeWithAnnotations possiblyRestrictedTypeSymbol)
{
_possiblyRestrictedTypeSymbol = possiblyRestrictedTypeSymbol;
}
private LazyArrayElementCantBeRefAnyDiagnosticInfo(LazyArrayElementCantBeRefAnyDiagnosticInfo original, DiagnosticSeverity severity)
: base(original, severity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_possiblyRestrictedTypeSymbol = original._possiblyRestrictedTypeSymbol;
}
protected override DiagnosticInfo GetInstanceWithSeverityCore(DiagnosticSeverity severity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return (DiagnosticInfo)(object)new LazyArrayElementCantBeRefAnyDiagnosticInfo(this, severity);
}
protected override DiagnosticInfo ResolveInfo()
{
if (_possiblyRestrictedTypeSymbol.IsRestrictedType())
{
return (DiagnosticInfo)(object)new CSDiagnosticInfo(ErrorCode.ERR_ArrayElementCantBeRefAny, _possiblyRestrictedTypeSymbol.Type);
}
return null;
}
}