Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ internal bool InfersNullableAnnotation
}
}

/// <summary>
/// Gets the inferred nullable annotation of the backing field,
/// potentially binding and nullable-analyzing the associated get accessor.
/// </summary>
/// <remarks>
/// The <see cref="FieldSymbol.TypeWithAnnotations"/> for this symbol does not expose this inferred nullable annotation.
/// For that API, the nullable annotation of the associated property is used instead.
/// </remarks>
internal NullableAnnotation GetInferredNullableAnnotation()
{
if (_inferredNullableAnnotation == (int)NullableAnnotation.Ignored)
Expand Down
5 changes: 5 additions & 0 deletions src/Compilers/Core/Portable/Symbols/IFieldSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public interface IFieldSymbol : ISymbol
/// <summary>
/// Gets the top-level nullability of this field.
/// </summary>
/// <remarks>
/// The inferred nullability of a backing field symbol (for example, the symbol for a <see langword="field"/> keyword) is not exposed by this API.
/// In that case, this API returns the nullable annotation of the associated property.
/// The inferred nullability is only exposed indirectly via APIs that give information about expressions, such as <see cref="SemanticModel.GetTypeInfo"/> when called with a <see langword="field"/> expression.
/// </remarks>
NullableAnnotation NullableAnnotation { get; }

/// <summary>
Expand Down
Loading